RcppCore / RcppEigen

Rcpp integration for the Eigen templated linear algebra library
Other
110 stars 40 forks source link

Installation issue on RHEL 7.9 with gcc-4.8.5 or gcc-5.3.1 #112

Closed EmanueleCagliero closed 2 years ago

EmanueleCagliero commented 2 years ago

On a Linux RedHat 7.9 system, using gcc-4.8.5 or gcc-5.3.1, the installation of RcppEigen fails with the following error:

*g++ -m64 -std=gnu++11 -I"/usr/include/R" -DNDEBUG -I"/usr/lib64/R/library/Rcpp/include" -I/usr/local/include -I../inst/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c fastLm.cpp -o fastLm.o fastLm.cpp: In function ‘int lmsol::gesdd(Eigen::MatrixXd&, Eigen::ArrayXd&, Eigen::MatrixXd&)’: fastLm.cpp:147:54: error: expected ‘)’ before ‘FCONE’ &m, Vt.data(), &n, &wrk, &mone, &iwork[0], &info FCONE); ^ fastLm.cpp:151:59: error: expected ‘)’ before ‘FCONE’ &m, Vt.data(), &n, &work[0], &lwork, &iwork[0], &info FCONE); ^ make: ** [fastLm.o] Error 1 ERROR: compilation failed for package ‘RcppEigen’

Looking at forums and stackoverflow threads, it looks like an issue with C++14 instructions, maybe. Unfortunately I was not able to find a workaround. Is it a well-known compiling issue (for which the fixing is known)?

eddelbuettel commented 2 years ago

In short, your compiler is (way !!) too old. RHEL / CentOS have something called devtoolset which IIRC gives gcc-8. That should work.

Besides that the error is from a change R Core makes us Fortran-interfacing developers do to improve some interaction with char variables. There are ample posts about that, even search for FCONE (along with R or alike) should lead somewhere.

But long story short: your setup is too dated for the software you want. You can also try an older RcppEigen from its Archive/ section on CRAN which make rstan happy enough.

EmanueleCagliero commented 2 years ago

I installed devtoolset, with gcc-8, and modified the ".Makeconf" file used by R in order for it to use gcc-8, but the RcppEigen installation error keeps arising. Will ask to RedHat support if I am doing it correctly.

Instead, older versions of RcppEigen get installed correctly! In particular RcppEigen_0.3.3.3.0 Thank you.

(Unfortunately, though, I was installing RcppEigen because it is a dependency of the package rstan, but rstan installation does not work with this old RcppEigen version. I have tried some old versions of rstan too, like rstan_2.17.3, with no luck.)

eddelbuettel commented 2 years ago

Oh, sorry, yes -- I forget about the versioned dependency rstan may have on RcppEigen as they are fairly closely linked.

I think your best bet may be talking to other rstan users on an equally dated platform. Maybe using a matching older pair of both works, maybe using this via Docker works, or maybe just mayne there is another ~/.R/Makevars that does the trick,

But I suggest we close this as there issue is not really with RcppEigen which passes all its test set up by CRAN as seen here.

eddelbuettel commented 2 years ago

Also, what R version do you use? I don't recall when that macro setting the Fortran change got introduced but just in case it also required to have a recent-enough R.

EmanueleCagliero commented 2 years ago

I use R 3.6.0 on platform x86_64-redhat-linux-gnu; corporate restrictions currently prevent the system administrators to update it. (To match the rstan and RcppEigen versions I looked at the release dates, but it did not work. I will try some other combination of versions.)

Anyway, fortunately the issue does not show up on another machine, where I use R 4.1.1 on platform x86_64-w64-mingw32. Thank you for the clarifications and yes, sure we can close this github issue.

eddelbuettel commented 2 years ago

Yes we did of course have working rstan + RcppEigen combinations at the time, may be a little trial and error to find them.

Glad you have it working under R 4.1.1. I will close this now.

EmanueleCagliero commented 2 years ago

Just in case anybody else stumbles upon this problem: I succeeded in installing "rstan", that in turn requires "RcppEigen", on a machine with RHEL 7, with the following procedure: