Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem loading shared library, causing failure to install package (0.9.3/master@a50e34643cf93ce578eb90a29f765c25760a12ae) #43

Closed
sanmai-NL opened this issue Oct 22, 2015 · 1 comment

Comments

@sanmai-NL
Copy link

I had trouble tonight installing the curl package under R 3.2.1 with a manually built and installed curl library at 7.44.0, installed under a prefix $HOME/prefix. Many other source packages could be successfully built with the same configuration, and in the end some unclear combination of changes made the error go away. I'm still puzzled what the problem was, and I'm wondering whether R and/or the Makefile dealing correctly with my Makevars file. I'm not very familiar with the Makevars file in R, it could well be incorrect.

Can you look into this issue and tell me what has caused the problem and whether something should be fixed?

Context

~/.R/Makevars:

PKG_LIBS = -L${HOME}/prefix/lib        
PKG_CPPFLAGS = -I${HOME}/prefix/include

Environment variables

PKG_CONFIG_PATH=$HOME/prefix/lib/pkgconfig
Linux *.nl 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1 (2015-05-24) x86_64 GNU/Linux

Sys.getenv('LD_LIBRARY_PATH')
# [1] "/usr/lib/R/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/default-java/jre/lib/amd64/server:/home/myname/prefix/lib/"

GCC

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.2-10' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.9.2 (Debian 4.9.2-10)

Failure

install.packages('curl') resulted in this failure:

* installing *source* package ‘curl’ ...
** package ‘curl’ successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-I/home/myname/prefix/include 
Using PKG_LIBS=-L/home/myname/prefix/lib -lcurl 
** libs
"/usr/lib/R/bin/Rscript" "../tools/options.R"
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG "-I/home/myname/prefix/include"    "-I/home/myname/prefix/include" -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c callbacks.c -o callbacks.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG "-I/home/myname/prefix/include"    "-I/home/myname/prefix/include" -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c curl.c -o curl.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG "-I/home/myname/prefix/include"    "-I/home/myname/prefix/include" -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c download.c -o download.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG "-I/home/myname/prefix/include"    "-I/home/myname/prefix/include" -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c escape.c -o escape.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG "-I/home/myname/prefix/include"    "-I/home/myname/prefix/include" -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c fetch.c -o fetch.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG "-I/home/myname/prefix/include"    "-I/home/myname/prefix/include" -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c form.c -o form.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG "-I/home/myname/prefix/include"    "-I/home/myname/prefix/include" -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c getdate.c -o getdate.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG "-I/home/myname/prefix/include"    "-I/home/myname/prefix/include" -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c handle.c -o handle.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG "-I/home/myname/prefix/include"    "-I/home/myname/prefix/include" -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c ieproxy.c -o ieproxy.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG "-I/home/myname/prefix/include"    "-I/home/myname/prefix/include" -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG "-I/home/myname/prefix/include"    "-I/home/myname/prefix/include" -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c utils.c -o utils.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG "-I/home/myname/prefix/include"    "-I/home/myname/prefix/include" -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c version.c -o version.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o curl.so callbacks.o curl.o download.o escape.o fetch.o form.o getdate.o handle.o ieproxy.o init.o utils.o version.o -L/home/myname/prefix/lib -L/usr/lib/R/lib -lR
installing to /home/myname/R/x86_64-pc-linux-gnu-library/3.2/curl/libs
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/home/myname/R/x86_64-pc-linux-gnu-library/3.2/curl/libs/curl.so':
  /home/myname/R/x86_64-pc-linux-gnu-library/3.2/curl/libs/curl.so: undefined symbol: curl_easy_escape
Error: loading failed

Success

Commenting out the Makevars, and building from the current master revision with
R CMD INSTALL --configure-vars="INCLUDE_DIR=$HOME/prefix/include LIB_DIR=$HOME/prefix/lib" "$HOME/installers/curl"
is successful:

* installing *source* package ‘curl’ ...
** package ‘curl’ successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-I/home/myname/prefix/include 
Using PKG_LIBS=-L/home/myname/prefix/lib -lcurl 
** libs
"/usr/lib/R/bin/Rscript" "../tools/options.R"
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/home/myname/prefix/include      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c callbacks.c -o callbacks.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/home/myname/prefix/include      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c curl.c -o curl.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/home/myname/prefix/include      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c download.c -o download.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/home/myname/prefix/include      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c escape.c -o escape.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/home/myname/prefix/include      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c fetch.c -o fetch.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/home/myname/prefix/include      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c form.c -o form.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/home/myname/prefix/include      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c getdate.c -o getdate.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/home/myname/prefix/include      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c handle.c -o handle.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/home/myname/prefix/include      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c ieproxy.c -o ieproxy.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/home/myname/prefix/include      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/home/myname/prefix/include      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c utils.c -o utils.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/home/myname/prefix/include      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c version.c -o version.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-z,relro -o curl.so callbacks.o curl.o download.o escape.o fetch.o form.o getdate.o handle.o ieproxy.o init.o utils.o version.o -L/home/myname/prefix/lib -lcurl -L/usr/lib/R/lib -lR
installing to /home/myname/R/x86_64-pc-linux-gnu-library/3.2/curl/libs
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (curl)
@sanmai-NL sanmai-NL changed the title 0.9.3/ Problem loading shared library, causing failure to install package Problem loading shared library, causing failure to install package (0.9.3/master@a50e34643cf93ce578eb90a29f765c25760a12ae) Oct 22, 2015
@jeroen jeroen closed this as completed Oct 31, 2015
@jeroen
Copy link
Owner

jeroen commented Oct 31, 2015

You should not be setting anything in ~/.R/Makevars, other than debug flags or so. The configure script will pick up the cflags and libs from pkg-config.

In your first output it is missing -lcurl in the linking step. I don't know how you managed to do this. Maybe the correct PKG_LIBS value from pkg-config was overwritten by the one from your ~/.R/Makevars. Other than that you seem to be doing everything right. Just delete your ~/.R/Makevars and it should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants