libR.so Library sharing failure

Dear Rstan Communit,

Operating System: Linux
Interface Version: R v3.4.2
Output of writeLines(readLines(file.path(Sys.getenv(“HOME”), “.R/Makevars”))): No .R directoy
Output of devtools::session_info("rstan”): don’t (and can’t) have devtools.

I am trying to put some dev Rstan script in production on a massive cluster.
I compiled R (3.4.2) myself and installed all packages manually from tar.gz (no direct internet access).

During the installation of Rstan numerous warnings show up. All on the same pattern:
R-3.4.2/library/StanHeaders/include/src/stan/lang/ast/node/conditional_op.hpp:40:23: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]
bool has_var_ = false;

1/ Is this an issue that may explain or alter Rstan ?

2/ When I use the sampling function, I get this error:
Error in dyn.load(libLFile) :
unable to load shared object ‘/tmp/RtmpJA0O3Y/file7b351be75647.so’:
libR.so: cannot open shared object file: No such file or directory

I tried to install R with “–enable-R-shlib=yes” but it fails.
3/ Is it a required flag for Rstan ?

Thanks for reading,
Alban

You need to compile with -std=c++11 in CXXFLAGS to get rid of that warning or just ignore it

It seems odd that you can start R and R be unable to open libR.so. That seems like a problem with your setup, but you may be able to work around it by first doing

dyn.lib("/usr/lib/libR.so")

or whatever path libR.so is on for your server.

Under normal circumstances, no.

1 Like

Thanks for your support.

If anyone is coming here with the same problem:
I recompiled R with the “–enable-R-shlib” flag and now Rstan works like a charm.
(Don’t be like me: don’t forget to use “make clean” before recompiling)

Unfortunatly, I can’t tell how I am not in “normal circumstances” :(

Thank you!

yes, I have the same issue :(

Was R compiled with or without the -enable-R-shlib flag?