Internal compiler error on TravisCI when compiling Modules.cpp


I am trying to convert packages using rstan to 2.16.2. Some problems encountered have been solved:

thanks to @bgoodri, @helske and a trick by Dirk Eddelbuettel.

Two packages (the sample and the real one with only one stan model work ok, both with clang-5.0 and gcc-6. A third package with multiple stan files fails with

g++ -I/home/travis/R-bin/lib/R/include -DNDEBUG -I"“/home/travis/R-bin/lib/R/bin/Rscript” --vanilla -e “cat(system.file(‘include’, ‘src’, package = ‘StanHeaders’))”" -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=ignore_error -I"/home/travis/R/Library/StanHeaders/include" -I"/home/travis/R/Library/rstan/include" -I"/home/travis/R/Library/BH/include" -I"/home/travis/R/Library/Rcpp/include" -I"/home/travis/R/Library/RcppEigen/include" -I/home/travis/R-bin/include -fpic -g -O2 -c Modules.cpp -o Modules.o

g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
make: *** [Modules.o] Error 4
ERROR: compilation failed for package ‘gastempt’

Same error with gcc and clang. I suspect an out-of-memory condition, but how to test this and what to do against it? The package compiled ok with stan1.5.2 and is on CRAN.


Yeah, that is hitting the memory limit of the machine. You could try compiling with -Os instead of -O2.


Using sudo:required gives more memory, and is not as slow as it used to be.