ok, that’s actually a bit more complicated when building with Spack as Spack uses compiler wrappers… In addition, the build/unix/compiledata.sh
script is actually using basename $CXX
anyway…
What I tried then is patch the compiledata.sh
(in the root spack recipe) to end up with a makeshared that I believe should work (note the absolute path to the compiler, which is what I want/need) :
root [0] gSystem->GetMakeSharedLib()
(const char *) "cd $BuildDir; /usr/bin/clang++ -fPIC -c $Opt -std=c++17 -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -m64 -pipe -W -Woverloaded-virtual -fsigned-char -fno-common -Qunused-arguments -pthread -stdlib=libc++ $IncludePath $SourceFiles; /usr/bin/clang++ $Opt $ObjectFiles -dynamiclib -Wl,-headerpad_max_install_names -m64 -single_module -Wl,-dead_strip_dylibs -o $SharedLib"
But I get another error then :
dev🚀~/tmp$ root -b
. ------------------------------------------------------------------
| Welcome to ROOT 6.24/02 https://root.cern |
| (c) 1995-2021, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for macosx64 on Jun 28 2021, 09:28:51 |
| From tags/v6-24-02@v6-24-02 |
| With Apple clang version 12.0.5 (clang-1205.0.22.11) |
| Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
------------------------------------------------------------------
root [0] .L test.C++
Info in <TMacOSXSystem::ACLiC>: creating shared library /Users/laurent/tmp/compiled_macros//Users/laurent/tmp/./test_C.so
Undefined symbols for architecture x86_64:
"TVersionCheck::TVersionCheck(int)", referenced from:
__GLOBAL__sub_I_test_C_ACLiC_dict.cxx in test_C_ACLiC_dict.o
"TROOT::RegisterModule(char const*, char const**, char const**, char const*, char const*, void (*)(), std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int> > > const&, char const**, bool)", referenced from:
(anonymous namespace)::TriggerDictionaryInitialization_test_C_ACLiC_dict_Impl() in test_C_ACLiC_dict.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error in <ACLiC>: Executing 'cd "/Users/laurent/tmp/compiled_macros//Users/laurent/tmp"; /usr/bin/clang++ -fPIC -c -O2 -std=c++17 -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -m64 -pipe -W -Woverloaded-virtual -fsigned-char -fno-common -Qunused-arguments -pthread -stdlib=libc++ -I$ROOTSYS/include -isysroot "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" -I"/Users/laurent/opt/spack/spack_path_placeholder/spack_path_place/darwin-bigsur-skylake/apple-clang-12.0.5/root-6.24.02-rle6frk5sdtwrtigt4n6jbrz6ukhm2q3/etc/" -I"/Users/laurent/opt/spack/spack_path_placeholder/spack_path_place/darwin-bigsur-skylake/apple-clang-12.0.5/root-6.24.02-rle6frk5sdtwrtigt4n6jbrz6ukhm2q3/etc//cling" -I"/Users/laurent/opt/spack/spack_path_placeholder/spack_path_place/darwin-bigsur-skylake/apple-clang-12.0.5/root-6.24.02-rle6frk5sdtwrtigt4n6jbrz6ukhm2q3/include/" -I"/Users/laurent/opt/spack/spack_path_placeholder/spack_path_place/darwin-bigsur-skylake/apple-clang-12.0.5/python-3.8.10-44evhd5djtshjofdpmemzr6irocnjvgb/include/python3.8" -I"/usr/local/include" -I"/Users/laurent/opt/spack/spack_path_placeholder/spack_path_place/darwin-bigsur-skylake/apple-clang-12.0.5/root-6.24.02-rle6frk5sdtwrtigt4n6jbrz6ukhm2q3/include" -I"/private/var/folders/sk/tqly2lp512s0n9c1pc2njkkc0000gn/T/laurent/spack-stage/spack-stage-root-6.24.02-rle6frk5sdtwrtigt4n6jbrz6ukhm2q3/spack-build-rle6frk/include" -I"/Users/laurent/opt/spack/spack_path_placeholder/spack_path_place/darwin-bigsur-skylake/apple-clang-12.0.5/pcre-8.44-uepbfidmqaxlriok2472ce2bvkgduned/include" -I"/Users/laurent/opt/spack/spack_path_placeholder/spack_path_place/darwin-bigsur-skylake/apple-clang-12.0.5/xxhash-0.7.4-lhv3wec5xxct2mk5u2qjaoium7wdanlr/include" -I"/Users/laurent/opt/spack/spack_path_placeholder/spack_path_place/darwin-bigsur-skylake/apple-clang-12.0.5/lz4-1.9.3-exrsopfzkim7nxzv7bo6edqdivrcm3py/include" -I"/Users/laurent/opt/spack/spack_path_placeholder/spack_path_place/darwin-bigsur-skylake/apple-clang-12.0.5/zlib-1.2.11-74mwnxgn6nujehpyyalhwizwojwn5zga/include" -I"/Users/laurent/opt/spack/spack_path_placeholder/spack_path_place/darwin-bigsur-skylake/apple-clang-12.0.5/nlohmann-json-3.9.1-qbegteatr4uwv5wg72ig7mfi4oqxrfn4/include" -I"/private/var/folders/sk/tqly2lp512s0n9c1pc2njkkc0000gn/T/laurent/spack-stage/spack-stage-root-6.24.02-rle6frk5sdtwrtigt4n6jbrz6ukhm2q3/spack-build-rle6frk/include/" -D__ACLIC__ "/Users/laurent/tmp/compiled_macros//Users/laurent/tmp/test_C_ACLiC_dict.cxx"; /usr/bin/clang++ -O2 "/Users/laurent/tmp/compiled_macros//Users/laurent/tmp/test_C_ACLiC_dict.o" -dynamiclib -Wl,-headerpad_max_install_names -m64 -single_module -Wl,-dead_strip_dylibs -o "/Users/laurent/tmp/compiled_macros//Users/laurent/tmp/./test_C.so"' failed!