Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rcpp cannot find gsl library

Tags:

c++

r

rcpp

gsl

im out of ideas

Im trying to create a library for R, but i cant get it to load.

The error im getting is

Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/home/stenver/R/x86_64-pc-linux-gnu-    library/2.15/RcppWilcoxonTest/libs/RcppWilcoxonTest.so':
  /home/stenver/R/x86_64-pc-linux-gnu-library/2.15/RcppWilcoxonTest/libs/RcppWilcoxonTest.so:     undefined symbol: gsl_cdf_gaussian_Q
Error: loading failed

My Makevars file looks like this:

PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()" `

I have tried changing all kinds of stuff in there.

My NAMESPACE file looks like this:

useDynLib(RcppWilcoxonTest)
useDynLib(gsl)
useDynLib(WilcoxonTest)

import(Rcpp)

export(RcppWilcoxonTest)

The failure happens in the dynamic shared library i am trying to use. I have copied the dynamic library files to the src folder, so R would compile them itself, but it is of no use. Ideally, i would like to keep the library and Rcpp interface implementation in a separate folders.

At some point, i also tried to use RcppGSL, but it didnt help, as R couldnt find the package after install.

The entire repository can be seen here:

https://bitbucket.org/stenver/wilxoni-astaku-test/src/8c9b5da2cd9a97fd6c1a569e468c50ca95e2e06f?at=default

in the RcppWilcoxonTest folder

like image 639
user1047833 Avatar asked Nov 18 '25 15:11

user1047833


1 Answers

Kevin's answer will probably help you, but there is in fact one CRAN package explicitly depending on RcppGSL, and in it I do

edd@max:~/git/rcppziggurat/src$ cat Makevars
PKG_CPPFLAGS = -I. -I../inst/include
## Use the R_HOME indirection to support installations of multiple R version
PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` \
           `$(R_HOME)/bin/Rscript -e "RcppGSL:::LdFlags()"`
edd@max:~/git/rcppziggurat/src$ 

where I wrapped one line for the display here.

In essence, the RcppGSL invokes the same gsl-config that Kevin alluded to.

like image 195
Dirk Eddelbuettel Avatar answered Nov 20 '25 06:11

Dirk Eddelbuettel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!