haghish / rcall

Seamless interactive R in Stata. rcall allows communicating data sets, matrices, variables, and scalars between Stata and R conveniently
http://www.haghish.com/packages/Rcall.php
91 stars 29 forks source link

rcall installation. error while loading shared libraries: libgomp.so.1 #18

Closed zyzhang1992 closed 3 years ago

zyzhang1992 commented 3 years ago

We are installing rcall on a shared Linux cluster. The R installation is not in the standard location. The R executable is at /share/software/user/open/R/3.5.1/bin/R while the R libraries are in /share/software/user/open/R/3.5.1/lib64/R/lib/libR.so and ldd libR.so shows that libgomp.so.1 => /lib64/libgomp.so.1 (0x00007ff66b92e000)

The path is set to be rcall setpath /share/software/user/open/R/3.5.1/bin/R but rcall couldn't find the required libraries though:

rcall describe

     R path:   /share/software/user/open/R/3.5.1/bin/R

/share/software/user/open/R/3.5.1/lib64/R/bin/exec/R: error while loading shared libraries: libgomp.so.1: cannot open shared object file: No such file or directory

/share/software/user/open/R/3.5.1/lib64/R/bin/exec/R: error while loading shared libraries: libgomp.so.1: cannot open shared object file: No such file or directory R version: R was not accessed! R profile: ~/ado/plus/r/rprofile.site R history: ~/ado/plus/r/Rhistory.do

Is there a way to set the R library path in stata? How could I resolve this issue?

Thanks!

Zhiyong

haghish commented 3 years ago

This is not a bug and you can probably handle that within R Profile.site, to instruct R where to find the libraries. Have a look at this post and try to edit your R profile accordingly.

https://stackoverflow.com/questions/15170399/change-r-default-library-path-using-libpaths-in-rprofile-site-fails-to-work

zyzhang1992 commented 3 years ago

Thanks @haghish! I've added the following to the .Rprofile file: ​ .libPaths(c("/share/software/user/open/R/3.5.1/lib64/R/library", .libPaths())) .libPaths(c(".libPaths(), /share/software/user/open/icu/59.1/lib")) ​ That fixed the gomp library but still have issues with the icu libraries. Do you know how stata handles directories of the environments outside of stata? The error message now is:

. rcall ---------------------------------------------------- R (type end to exit) --------------------------------------------------------- . describe /share/software/user/open/R/3.5.1/lib64/R/bin/exec/R: error while loading shared libraries: libicuuc.so.59: cannot open shared object file: No such file or directory

/share/software/user/open/R/3.5.1/lib64/R/bin/exec/R: error while loading shared libraries: libicuuc.so.59: cannot open shared object file: No such file or directory

In our environment, R is installed as a module, with its relevant libraries in the location as specified in the .libpaths. The R module depends on icu and other modules, which are installed at different locations. Presumably stata/rcall seearches the R libraries, the location of which could be specified in .Rprofile and correctly recognized by stata/rcall. Now the issues are how stata/rcall resolve/search for libraries that are needed from other modules that R depend on.

Any suggestions? Is there a way to define something like LD_LIBRARY_PATH "within" stata for searching external libraries?

Thanks,

Zhiyong

haghish commented 3 years ago

Forget about Stata. First, try to use your R in a batch mode. Call R within terminal and let it execute a script file without entering R environment. Maybe this helps you solve the problem you are facing.

http://www.cureffi.org/2014/01/15/running-r-batch-mode-linux/