Trying to compile on cluster, clang not found, won't use g++

Operating System: Scientific Linux 6
Interface Version: cmd_stan-2.17.0
Compiler/Toolkit: g++

I’m trying to compile the recent version of cmd_stan on a cluster so i can compile my *.stan files there. Whenever I try make build I get the following error.

clang++ -Wall -I . -isystem stan/lib/stan_math/lib/eigen_3.3.3 -isystem stan/lib/stan_math/lib/boost_1.64.0 -isystem stan/lib/stan_math/lib/cvodes_2.9.0/include -std=c++1y -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -I src -I stan/src -isystem stan/lib/stan_math/ -DEIGEN_NO_DEBUG -DFUSION_MAX_VECTOR_SIZE=12 -Wno-unused-function -Wno-uninitialized -DNO_FPRINTF_OUTPUT -pipe -c -O3 -o bin/cmdstan/stanc.o src/cmdstan/stanc.cpp
make: clang++: Command not found
make: *** [bin/cmdstan/stanc.o] Error 127

Reading the makefile, I believe it should check that clang isn’t installed on my cluster and default to g++ but that doesn’t seem to be happening. Is there a work around I can use?

Cheers!

That helps, thanks. I guess I should have done some more thread necromancy.

However, now I have a new error

g++ -Wall -I . -isystem stan/lib/stan_math/lib/eigen_3.3.3 -isystem stan/lib/stan_math/lib/boost_1.64.0 -isystem stan/lib/stan_math/lib/cvodes_2.9.0/include -std=c++1y -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -I src -I stan/src -isystem stan/lib/stan_math/ -DEIGEN_NO_DEBUG -DFUSION_MAX_VECTOR_SIZE=12 -DNO_FPRINTF_OUTPUT -pipe  -c -O3 -o bin/cmdstan/stanc.o src/cmdstan/stanc.cpp
cc1plus: error: unrecognized command line option "-std=c++1y"
make: *** [bin/cmdstan/stanc.o] Error 1

A little google-ing indicates that this has to do with the C++ version and should probably be adjusted to c++14. Is this correct? And if so, what file would I have to update?

Thanks!

Check stan/lib/stan_math/make/default_compiler_options

But I’m surprised that option isn’t there for your gcc. What version are you using?

oh my. changing the default to c++14 didn’t work either. checking the version of gcc installed on the cluster it appears to be 4.4.7. i think that’s going to be the bigger issue here.

You can perhaps change the standard to g++99 or something supported by g++ version 4.4.7, but yes you should use a more recent compiler.

ok, i was able to load 4.8.5. switching the default options back to -std=c++1y seems to work. it is at least compiling now!

thanks for all the help.

1 Like

You might be interested in this, since you are on Scientific Linux: https://www.softwarecollections.org/en/scls/rhscl/devtoolset-6/

That should get you a compiler even more recent than g++ 4.8.5.