rg++eigenbrmsrcppeigen

Error when compiling R packages : Eigen/Core : new: no file or directory


This is my first question on stack ! Hope I follow correctly the guidelines...

Device

Problem

So, installing several packages of R (4.2) in rstudio, I encountered the same error with several dependencies (but not all). Eg here for mvtnorm or nleqslv (both while installing brms). (see error at the bottom of this message).

It seems that the problem concerns the line 82 of the Eigen/Core header, located in Rcppeigen directory. The #include <new> isn't correctly understood by the compiler.

What I've already done

As I'm on a Thinkpad laptop, this shouldn't appear. Should I use another compiler ?

Thanks for your help !

Log

* installing *source* package ‘mvtnorm’ ...
** package ‘mvtnorm’ correctement décompressé et sommes MD5 vérifiées
** using staged installation
** libs
gcc -I"/usr/include/R/" -DNDEBUG   -I"/home/jpapir/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include/"  -I"/home/jpapir/R/x86_64-pc-linux-gnu-library/4.2/RcppEigen/include/"  -I"/home/jpapir/R/x86_64-pc-linux-gnu-library/4.2/RcppEigen/include/unsupported"  -I"/home/jpapir/R/x86_64-pc-linux-gnu-library/4.2/BH/include" -I"/home/jpapir/R/x86_64-pc-linux-gnu-library/4.2/StanHeaders/include/src/"  -I"/home/jpapir/R/x86_64-pc-linux-gnu-library/4.2/StanHeaders/include/"  -I"/home/jpapir/R/x86_64-pc-linux-gnu-library/4.2/RcppParallel/include/"  -I"/home/jpapir/R/x86_64-pc-linux-gnu-library/4.2/rstan/include" -DEIGEN_NO_DEBUG  -DBOOST_DISABLE_ASSERTS  -DBOOST_PENDING_INTEGER_LOG2_HPP  -DSTAN_THREADS  -DBOOST_NO_AUTO_PTR  -include '/home/jpapir/R/x86_64-pc-linux-gnu-library/4.2/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp'  -D_REENTRANT -DRCPP_PARALLEL_USE_TBB=1   -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto -ffat-lto-objects  -c C_FORTRAN_interface.c -o C_FORTRAN_interface.o
Dans le fichier inclus depuis /home/jpapir/R/x86_64-pc-linux-gnu-library/4.2/RcppEigen/include/Eigen/Dense:1,
                 depuis /home/jpapir/R/x86_64-pc-linux-gnu-library/4.2/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
                 depuis <ligne-de-commande>:
/home/jpapir/R/x86_64-pc-linux-gnu-library/4.2/RcppEigen/include/Eigen/Core:82:12: erreur fatale: new : Aucun fichier ou dossier de ce type
   82 |   #include <new>
      |            ^~~~~
compilation terminée.
make: *** [/usr/lib64/R/etc/Makeconf:169 : C_FORTRAN_interface.o] Erreur 1
ERROR: compilation failed for package ‘mvtnorm’
* removing ‘/home/jpapir/R/x86_64-pc-linux-gnu-library/4.2/mvtnorm’
Warning in install.packages :
  l'installation du package ‘mvtnorm’ a eu un statut de sortie non nul

Solution

  • Well, finally I solved it myself after some hours stacking with it.

    So. In order to install Rstan, I followed these instructions. In order to revert it, I deleted the content of the file .R/Makevars and I restarted R. I don't know why it was creating this error. But the issue seems now to be solved.