eddelbuettel / rcppziggurat

Rcpp bindings for different Ziggurat RNG implementations
Other
12 stars 4 forks source link

Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/usr/lib/R/library/RcppGSL/libs/RcppGSL.so': libgsl.so.23: cannot open shared object file: No such file or directory #18

Closed englianhu closed 2 years ago

englianhu commented 2 years ago
:~$ sudo su - -c "R -e \"devtools::install_github('eddelbuettel/rcppziggurat', INSTALL_opts = '--no-lock', force = TRUE)\""
R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> devtools::install_github('eddelbuettel/rcppziggurat', INSTALL_opts = '--no-lock', force = TRUE)
Downloading GitHub repo eddelbuettel/rcppziggurat@HEAD

   checking for file ‘/tmp/RtmpSnAWxn/remotes13b82702c7e0f/eddelbuettel-rcppzig✔  checking for file ‘/tmp/RtmpSnAWxn/remotes13b82702c7e0f/eddelbuettel-rcppziggurat-4903377/DESCRIPTION’
─  preparing ‘RcppZiggurat’:
✔  checking DESCRIPTION meta-information ...
─  cleaning src
─  running ‘cleanup’
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘RcppZiggurat_0.1.6.1.tar.gz’

* installing *source* package ‘RcppZiggurat’ ...
staged installation is only possible with locking
** using non-staged installation
** libs
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I. -I../inst/include -I'/usr/lib/R/library/Rcpp/include' -I'/usr/lib/R/library/RcppGSL/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-apO4Ea/r-base-4.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c RcppExports.cpp -o RcppExports.o

g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I. -I../inst/include -I'/usr/lib/R/library/Rcpp/include' -I'/usr/lib/R/library/RcppGSL/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-apO4Ea/r-base-4.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c ziggurat.cpp -o ziggurat.o
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/usr/lib/R/library/RcppGSL/libs/RcppGSL.so':
  libgsl.so.23: cannot open shared object file: No such file or directory
Calls: loadNamespace -> library.dynam -> dyn.load
Execution halted
g++ -std=gnu++14 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o RcppZiggurat.so RcppExports.o ziggurat.o -L/usr/lib/R/lib -lR
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/usr/lib/R/library/RcppGSL/libs/RcppGSL.so':
  libgsl.so.23: cannot open shared object file: No such file or directory
Calls: loadNamespace -> library.dynam -> dyn.load
Execution halted
installing to /usr/lib/R/library/RcppZiggurat/libs
** R
** demo
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error: package or namespace load failed for ‘RcppZiggurat’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/usr/lib/R/library/RcppZiggurat/libs/RcppZiggurat.so':
  /usr/lib/R/library/RcppZiggurat/libs/RcppZiggurat.so: undefined symbol: gsl_rng_default
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/lib/R/library/RcppZiggurat’
Warning message:
In i.p(...) :
  installation of package ‘/tmp/RtmpkdsY8z/file135db57b9647f/RcppZiggurat_0.1.6.1.tar.gz’ had non-zero exit status
englianhu commented 2 years ago
:~$ ## install RcppGSL first and follow by install RcppZiggurat
:~$ sudo su - -c "R -e \"install.packages(c('RcppGSL'), repos='https://cran.rstudio.org', lib='/usr/lib/R/library', dependencies = TRUE, INSTALL_opts = '--no-lock')\""
:~$ sudo su - -c "R -e \"devtools::install_github('eddelbuettel/rcppziggurat', INSTALL_opts = '--no-lock', force = TRUE)\""
eddelbuettel commented 2 years ago

You do not have GSL installed such that you can compile against it and you are invoking too many commands blindly to see thr espective error message:

  libgsl.so.23: cannot open shared object file: No such file or directory

That makes me think you are on, say, Ubuntu or Debian and have libgsl23 install _but are missing libgsl-dev.

So do sudo apt install gsl-dev (or the equivalent on whatever OS you are on) and you should be good to go afterwards.

eddelbuettel commented 2 years ago

## install RcppGSL first and follow by install RcppZiggurat

Or you could just have installed both from CRAN and RcppZiggurat would have pulled RcppGSL in.