Use CXX to specify compiler?


Operating System: ubuntu
Interface Version: 2.17.0
Compiler/Toolkit: clang-3.9

It looks like, for example, using CXX=clang±3.9 is not enough:

$ make foo/bar CXX=clang+±3.9

— Translating Stan model to C++ code —
bin/stanc foo/bar.stan --o=foo/bar.hpp
Model name=bar_model
Input file=foo/bar.stan
Output file=foo/bar.hpp
clang++ -DNO_FPRINTF_OUTPUT -pipe -c -x c -O3 -isystem stan/lib/stan_math/lib/cvodes_2.9.0/include stan/lib/stan_math/lib/cvodes_2.9.0/src/nvec_ser/nvector_serial.c -o stan/lib/stan_math/lib/cvodes_2.9.0/src/nvec_ser/nvector_serial.o
make: clang++: Command not found
make: *** [stan/lib/stan_math/lib/cvodes_2.9.0/src/nvec_ser/nvector_serial.o] Error 127

Is this a bug in the makefiles?


I am not sure whether CmdStan honors CXX that is set in the call to make. In the past I have used clang++-3.9 successfully.


Yes, it’s fine to build bin/stanc, etc with make CXX= … But somehow it was using clang++ for building the model even though I don’t have clang++, by which I mean an executable file called clang++ because it’s called clang+±3.9.


Right now, there isn’t consistency. You’ll need to set both CC and CXX in order for it to work.

I think the right thing to do is to set it so CXX controls the C++ compiler. That needs to get up to the Math library (not technically, but that’s the easiest way for it to be consistent across all the C++ repos).


thanks. setting CC for building models worked.