Error installing cmdstan in linux: it's trying to use clang

Operating System: linux
Interface Version: cmdstan
Compiler/Toolkit: g++

Even though the makefile appears to have g++ set as the compiler, it’s trying to call clang++, and that compiler is not installed.

[c1-01-3 cmdstan-2.17.0] make --debug -f ./makefile build
GNU Make 3.81
Copyright © 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A

This program built for x86_64-redhat-linux-gnu
Reading makefiles…
Updating goal targets…
File build' does not exist. Filebin/stanc’ does not exist.
File bin/cmdstan/stanc.o' does not exist. Must remake targetbin/cmdstan/stanc.o’.
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 -stdlib=libc++ -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

I tried pasting in the makefile, but this web site won’t let me because it interprets part of the makefile as URLs and those are restricted for new users.

Here’s the relevant part of the makefile:

CC = g++
O = 3
AR = ar

Why is make trying to use clang++ instead of g++?

Sorry about that. Not sure and I think we (the devs) need to debug this. The makefiles were changed for this release, so it had some unintended side-effects.

To fix, I think you should be able to do this:

  1. Open a file called make/local (no file extension)
  2. Inside that file, put
    CC = g++
    CXX = g++

Then clean and build again:

> make clean-all
> make build

Let me know if that works. I’ll open up an issue for it.

That worked!! Thanks for the amazingly fast reply!!

Now I’m having a different problem. When I make my stan program, it can’t find a shared object file:

/gpfs/fs0/data/itlab/helmod/apps/Core/gcc/5.3.0-fasrc01/bin/…/libexec/gcc/x86_64-unknown-linux-gnu/5.3.0/cc1plus: error while loading shared libraries: cannot open shared object file: No such file or directory

I’m doing this in the cmdstan home directory as indicated in the manual.

Any suggestions?


I don’t know that error. I don’t know what brings in that library.

It was a path problem on my end. I fixed it. Thanks for your help!