Compiling error when running model in Ubuntu 18.04. Any ideas?

I have a linux server I want to use for running some brms models.

So far I have been able to install the packages without any major issues. But when I run the model I get this error message:

Error in compileCode(f, code, language = language, verbose = verbose) : Compilation ERROR, function(s)/method(s) not created! In file included from /usr/local/lib/R/site-library/RcppEigen/include/Eigen/Core:392:0, from /usr/local/lib/R/site-library/RcppEigen/include/Eigen/Dense:1, from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:4, from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/core/build_vari_array.hpp:4, from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/core.hpp:5, from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/mat.hpp:4, from /usr/local/lib/R/site-library/StanHeaders/include/stan/math.hpp:4, from /usr/local/lib/R/site-library/StanHeaders/include/src/stan/model/model_header.hpp:4, from file22814fd3eb3a.cpp:8: /usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:60:39: warning: ig In addition: Warning message: In system(cmd, intern = !verbose) : running command ‘/usr/lib/R/bin/R CMD SHLIB file22814fd3eb3a.cpp 2> file22814fd3eb3a.cpp.err.txt’ had status 1 Error in sink(type = “output”) : invalid connection

I suspect there is something wrong with the installation of some package, but I am unsure what to do about it.

Server is using Ubuntu Server version 18.04 LTS (bionic) 64-bit, and I have the latest g++ compiler. The specs are Memory Size: 2048MB Disk 1:20GB
I am using brms 2.10

Also, maybe unrelated, when I install some packages (for example httpuv) I get a bunch of these warnings:

In file included from /usr/local/lib/R/site-library/BH/include/boost/shared_ptr.hpp:17:0, from /usr/local/lib/R/site-library/BH/include/boost/date_time/gregorian/greg_month.hpp:14, from /usr/local/lib/R/site-library/BH/include/boost/date_time/gregorian/greg_ymd.hpp:16, from /usr/local/lib/R/site-library/BH/include/boost/date_time/gregorian/greg_calendar.hpp:17, from /usr/local/lib/R/site-library/BH/include/boost/date_time/gregorian/gregorian_types.hpp:19, from /usr/local/lib/R/site-library/BH/include/boost/date_time/posix_time/posix_time_config.hpp:18, from /usr/local/lib/R/site-library/BH/include/boost/date_time/posix_time/posix_time_system.hpp:13, from /usr/local/lib/R/site-library/BH/include/boost/date_time/posix_time/ptime.hpp:12, from /usr/local/lib/R/site-library/BH/include/boost/date_time/posix_time/posix_time.hpp:15, from /usr/local/lib/R/site-library/BH/include/boost/date_time/local_time/local_time.hpp:11, from /usr/local/lib/R/site-library/BH/include/boost/date_time.hpp:15, from utils.h:13, from fs.cpp:2: /usr/local/lib/R/site-library/BH/include/boost/smart_ptr/shared_ptr.hpp:471:31: warning: ‘template class std::auto_ptr’ is deprecated [-Wdeprecated-declarations] explicit shared_ptr( std::auto_ptr & r ): px(r.get()), pn()

Maybe it is relevant?

Is anyone able to see the issue here?

Do

example(stan_model, package = "rstan", run.dontrun = TRUE)

and tell us the line that includes error: (with the colon).

I get this:

Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from /usr/local/lib/R/site-library/RcppEigen/include/Eigen/Core:392:0,
from /usr/local/lib/R/site-library/RcppEigen/include/Eigen/Dense:1,
from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:4,
from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/core/build_vari_array.hpp:4,
from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/core.hpp:5,
from /usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/mat.hpp:4,
from /usr/local/lib/R/site-library/StanHeaders/include/stan/math.hpp:4,
from /usr/local/lib/R/site-library/StanHeaders/include/src/stan/model/model_header.hpp:4,
from file6ba25192c88d.cpp:8:
/usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/Core/arch/SSE/PacketMath.h:60:39: warning: ig

What is packageVersion("rstan")? My guess is that you need to update.

packageVersion(“rstan”)
gives
‘2.19.2’

Then

example(stan_model, package = "rstan", run.dontrun = TRUE)

should have produced about 1000 lines more, one of which has error: in it.

I am sorry, if I have made a mistake, but I dont see anywhere it has error: in it. It has a lot of line, but nowhere just error:.

I have made a pastebin dump on gist.github with the full output. Maybe that will help.

link: https://gist.github.com/LauritsDixen/5e7e9ece40e1e6ad80b9d189050107e9

The file got truncated before it hit the error:

You can (and should) add -Wno-ignored-attributes to CXX14FLAGS in ~/.R/Makevars in order to suppress most of those warnings and thereby actually see the error message.

Will do and return with the results shortly.

edit: This might be the error is coming from, as ~/.R/Makevars is empty and there is another ~/.R/Makevars.win file with

CXX14FLAGS=-O3 -march=native

CXX14 = $(BINPREF)g++ -m$(WIN) -std=c++1y

CXX11FLAGS=-O3 -march=native

in it.
Should I add -Wno-ignored-attributes to this file instead?

You should not have a ~/.R/Makevars.win file on Ubuntu. Delete that and follow

Okay, I have deleted the Makevars.win file and ran the code from C++ toolchain configuration. The I ran example(stan_model, package = "rstan", run.dontrun = TRUE) again.

The only place I see error: is in this line g++: internal compiler error: Killed (program cc1plus). But the output is only 1000 lines now.
I have also just uploaded it again here: https://gist.github.com/LauritsDixen/28f61694f03469ce4df4ad179969084e

That means you ran out of RAM when compiling.

Allright, that is very unfortunate, as I have already upgraded my RAM space to do the modeling. Thank you very much for helping me! Do you have any idea how much RAM is typically needed when running these models?

It will take a several GB to install rstan with g++. After that, it usually takes a couple of GB to compile a model, but very little RAM to run, although that depends on how much you are storing. It takes less RAM to compile with clang++ so you might look into that.

I will look into that then. Thank you again for your help.