I’m trying to compile cmdstan v2.18.1 on a supercomputer. The HPC system hosts multiple GNU and non-GNU compilers. I’m using GNU compiler toolchain v.9.3.0. At the final linking stage of stanc the system uses a wrong path with rpath:
/lustre/system/local/apps/gcc9/9.3.0/bin/g++ -Wall -I . -isystem stan/lib/stan_math/lib/eigen_3.3.3 -isystem stan/lib/stan_math/lib/boost_1.66.0 -isystem stan/lib/stan_math/lib/sundials_3.1.0/include -std=c++1y -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -Wno-unused-function -Wno-uninitialized -I src -isystem stan/src -isystem stan/lib/stan_math/ -DFUSION_MAX_VECTOR_SIZE=12 -Wno-unused-local-typedefs -DEIGEN_NO_DEBUG -pthread -DNO_FPRINTF_OUTPUT -pipe -Wl,-rpath,/lustre/system/local/apps/gcc10/10.2.0/bin -O0 -o bin/stanc bin/cmdstan/stanc.o -Lbin -lstanc
Please see the -rpath flag and its value pointing to the GCC v10.2.0 binaries. Would you please tell me, where is this value is set? I would like to point the linker to the correct toolchain. The stanc is compiled even with the wrong rpath. But then I start to have problems compiling my models with stanc.
I tried to grep for the rpath value in the cmdstan distribution, but the results list is overwhelming.
When I try to compile the model with stanc I face the following errors:
../../bin/stanc: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by ../../bin/stanc)
../../bin/stanc: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ../../bin/stanc)
../../bin/stanc: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ../../bin/stanc)
../../bin/stanc: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ../../bin/stanc)
--- Translating Stan model to C++ code ---
bin/stanc analyses/normal_lpdf/normal_lpdf.stan --o=analyses/normal_lpdf/normal_lpdf.hpp
bin/stanc: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by bin/stanc)
bin/stanc: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by bin/stanc)
bin/stanc: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by bin/stanc)
bin/stanc: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by bin/stanc)
make: *** [analyses/normal_lpdf/normal_lpdf.hpp] Error 1