New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling model with g++ fails with "cc1plus: fatal error: -pch: No such file or directory" #583

Open
jjramsey opened this Issue Nov 6, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@jjramsey
Contributor

jjramsey commented Nov 6, 2017

When attempting to compile a model using the current "develop" branch of CmdStan, I get the error message "cc1plus: fatal error: -pch: No such file or directory". This is the output that I get when running make ../Armor_problem/RHA-mat-params-fitting/models/jc_normalNoise:

bin/stanc  ../Armor_problem/RHA-mat-params-fitting/models/jc_normalNoise.stan --o=../Armor_problem/RHA-mat-params-fitting/models/jc_normalNoise.hpp
Model name=jc_normalNoise_model
Input file=../Armor_problem/RHA-mat-params-fitting/models/jc_normalNoise.stan
Output file=../Armor_problem/RHA-mat-params-fitting/models/jc_normalNoise.hpp
Compiling pre-compiled header
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 -Wno-unused-function -Wno-uninitialized -I src -I stan/src -isystem stan/lib/stan_math/ -DEIGEN_NO_DEBUG -DFUSION_MAX_VECTOR_SIZE=12 -DNO_FPRINTF_OUTPUT -pipe  -c -O3 stan/src/stan/model/model_header.hpp -o stan/src/stan/model/model_header.hpp.gch

--- Linking C++ model ---
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 -Wno-unused-function -Wno-uninitialized -I src -I stan/src -isystem stan/lib/stan_math/ -DEIGEN_NO_DEBUG -DFUSION_MAX_VECTOR_SIZE=12 -DNO_FPRINTF_OUTPUT -pipe -lpthread  -include-pch stan/src/stan/model/model_header.hpp.gch -O3 -o ../Armor_problem/RHA-mat-params-fitting/models/jc_normalNoise src/cmdstan/main.cpp -include ../Armor_problem/RHA-mat-params-fitting/models/jc_normalNoise.hpp stan/lib/stan_math/lib/cvodes_2.9.0/lib/libsundials_nvecserial.a stan/lib/stan_math/lib/cvodes_2.9.0/lib/libsundials_cvodes.a
cc1plus: fatal error: -pch: No such file or directory
compilation terminated.
make/models:14: recipe for target '../Armor_problem/RHA-mat-params-fitting/models/jc_normalNoise' failed
make: *** [../Armor_problem/RHA-mat-params-fitting/models/jc_normalNoise] Error 1

This wasn't an issue with the release version of CmdStan 2.17.0.

The problem seems to be the use of the "-include-pch" option, which, as far as I can tell, is specific to clang. If I get rid of that flag and its associated argument in the file make/models, I can compile the model just fine.

(FWIW, the file stan/src/stan/model/model_header.hpp.gch is created just fine, and judging from https://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html, it should be used automatically, without any need for extra command line flags).

@seantalts seantalts self-assigned this Nov 8, 2017

seantalts added a commit that referenced this issue Dec 13, 2017

Merge pull request #584 from stan-dev/bug/0583-gcc-pch
Fix Compiling model with g++ fails with "cc1plus: fatal error: -pch: No such file or directory" #583
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment