ropensci / rsvg

SVG renderer for R based on librsvg2
Other
97 stars 1 forks source link

error during compilation: loading fails #18

Open lassancejm opened 4 years ago

lassancejm commented 4 years ago

Hi,

I am trying to install the package, but encounter an error indicating that the loading failed.

Thanks for your help!

Details about architecture:


>install.packages('rsvg')
Installing package into ‘/n/home01/lassance/apps/R’
[...]
* installing *source* package ‘rsvg’ ...
** package ‘rsvg’ successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-I/n/home01/lassance/.conda/envs/ENV_python3/include/librsvg-2.0 -I/n/home01/lassance/.conda/envs/ENV_python3/include/glib-2.0 -I/n/home01/lassance/.conda/envs/ENV_python3/lib/glib-2.0/include -I/n/home01/lassance/.conda/envs/ENV_python3/include -I/n/home01/lassance/.conda/envs/ENV_python3/include/gdk-pixbuf-2.0 -I/n/home01/lassance/.conda/envs/ENV_python3/include/cairo  
Using PKG_LIBS=-L/n/home01/lassance/.conda/envs/ENV_python3/lib -lrsvg-2 -lm -lgio-2.0 -lgdk_pixbuf-2.0 -lcairo -lgobject-2.0 -lglib-2.0  
** libs
gcc -I/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/curl/7.45.0-fasrc02/include -I/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/bzip2/1.0.6-fasrc02/include -I/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/xz/5.2.2-fasrc02/include -I/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/pcre/8.41-fasrc01/include -I/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/readline/6.3-fasrc03/include -L/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/bzip2/1.0.6-fasrc02/lib -L/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/xz/5.2.2-fasrc02/lib64 -L/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/pcre/8.41-fasrc01/lib -L/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/curl/7.45.0-fasrc02/lib -L/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/readline/6.3-fasrc03/lib64 -I"/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/R_core/3.5.1-fasrc02/lib64/R/include" -DNDEBUG -I/n/home01/lassance/.conda/envs/ENV_python3/include/librsvg-2.0 -I/n/home01/lassance/.conda/envs/ENV_python3/include/glib-2.0 -I/n/home01/lassance/.conda/envs/ENV_python3/lib/glib-2.0/include -I/n/home01/lassance/.conda/envs/ENV_python3/include -I/n/home01/lassance/.conda/envs/ENV_python3/include/gdk-pixbuf-2.0 -I/n/home01/lassance/.conda/envs/ENV_python3/include/cairo    -I/usr/local/include   -fpic  -g -O2  -c rsvg.c -o rsvg.o
gcc -I/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/curl/7.45.0-fasrc02/include -I/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/bzip2/1.0.6-fasrc02/include -I/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/xz/5.2.2-fasrc02/include -I/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/pcre/8.41-fasrc01/include -I/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/readline/6.3-fasrc03/include -L/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/bzip2/1.0.6-fasrc02/lib -L/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/xz/5.2.2-fasrc02/lib64 -L/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/pcre/8.41-fasrc01/lib -L/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/curl/7.45.0-fasrc02/lib -L/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/readline/6.3-fasrc03/lib64 -shared -L/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/R_core/3.5.1-fasrc02/lib64/R/lib -L/usr/local/lib64 -o rsvg.so rsvg.o -L/n/home01/lassance/.conda/envs/ENV_python3/lib -lrsvg-2 -lm -lgio-2.0 -lgdk_pixbuf-2.0 -lcairo -lgobject-2.0 -lglib-2.0 -L/n/helmod/apps/centos7/Comp/gcc/7.1.0-fasrc01/R_core/3.5.1-fasrc02/lib64/R/lib -lR
installing to /n/home01/lassance/apps/R/rsvg/libs
** R
** 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 ‘rsvg’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/n/home01/lassance/apps/R/rsvg/libs/rsvg.so':
  /n/home01/lassance/apps/R/rsvg/libs/rsvg.so: undefined symbol: rsvg_handle_set_stylesheet
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/n/home01/lassance/apps/R/rsvg’```
abcoxyzide commented 2 years ago

I bumped into the same problem.

librsvg-2 is one of the dependencies of this package, and my system doesn't have it. Since I don't have admin rights, I installed the library using conda, added the path to PKG_CONFIG_PATH as suggested by the package, ran install.packages('rsvg'), compiled ok, but failed to load.

It seems like rsvg depends on librsvg-2 to function, not just during compilation. So something about the environment variables allowed me to compile rsvg, but not when I load the package.

Probably a bit hacky, but adding the dir containing librsvg-2.so to LD_LIBRARY_PATH solved my issue.

Would appreciate if anyone could suggest a better solution, thanks.