jeroen / openssl

OpenSSL bindings for R
Other
63 stars 20 forks source link

undefined symbol: EVP_PKEY_sign #26

Closed vzemlys closed 8 years ago

vzemlys commented 8 years ago

I am trying to install package openssl and it seems that compilation runs fine, but then I get the following error:

** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared object '/home/tmp/soft/lib64/R/library/openssl/libs/openssl.so':
  /home/tmp/soft/lib64/R/library/openssl/libs/openssl.so: undefined symbol: EVP_PKEY_sign
Error: loading failed
Execution halted
ERROR: loading failed

The compilation seems to go without the errors, i.e. openssl.so is compiled cleanly. I have R (3.3.0) and openssl (1.0.2h) installed into non-standard locations and I am running on quite outdated Debian version 6.0.10, so that is probably the cause of all problems. But I would be grateful to any pointers how to resolve this issue.

jeroen commented 8 years ago

R is loading the (old) version of openssl from /usr/lib. Try setting LD_LIBRARY_PATH to your non-standard libssl.so and libcrypto.so, or copy them to /usr/local/lib.

vzemlys commented 8 years ago

I've tried:

Sys.setenv(LD_LIBRARY_PATH="/scratch/local/soft/lib64")

and I am seeing

> dir(Sys.getenv("LD_LIBRARY_PATH"))
[1] "engines"     "libcrypto.a" "libssl.a"    "pkgconfig"   "R"      

but the issue remains. When compiling I see the following message:

Using PKG_LIBS=-lssl -lcrypto
** libs
gcc -std=gnu99 -I/scratch/local/soft/lib64/R/include -DNDEBUG  -I/scratch/local/soft/include    -fpic  -g -O2  -c aes.c -o aes.o
gcc -std=gnu99 -I/scratch/local/soft/lib64/R/include -DNDEBUG  -I/scratch/local/soft/include    -fpic  -g -O2  -c base64.c -o base64.o
gcc -std=gnu99 -I/scratch/local/soft/lib64/R/include -DNDEBUG  -I/scratch/local/soft/include    -fpic  -g -O2  -c bignum.c -o bignum.o
gcc -std=gnu99 -I/scratch/local/soft/lib64/R/include -DNDEBUG  -I/scratch/local/soft/include    -fpic  -g -O2  -c cert.c -o cert.o
gcc -std=gnu99 -I/scratch/local/soft/lib64/R/include -DNDEBUG  -I/scratch/local/soft/include    -fpic  -g -O2  -c diffie.c -o diffie.o
gcc -std=gnu99 -I/scratch/local/soft/lib64/R/include -DNDEBUG  -I/scratch/local/soft/include    -fpic  -g -O2  -c envelope.c -o envelope.o
gcc -std=gnu99 -I/scratch/local/soft/lib64/R/include -DNDEBUG  -I/scratch/local/soft/include    -fpic  -g -O2  -c error.c -o error.o
gcc -std=gnu99 -I/scratch/local/soft/lib64/R/include -DNDEBUG  -I/scratch/local/soft/include    -fpic  -g -O2  -c hash.c -o hash.o
gcc -std=gnu99 -I/scratch/local/soft/lib64/R/include -DNDEBUG  -I/scratch/local/soft/include    -fpic  -g -O2  -c info.c -o info.o
gcc -std=gnu99 -I/scratch/local/soft/lib64/R/include -DNDEBUG  -I/scratch/local/soft/include    -fpic  -g -O2  -c keygen.c -o keygen.o
gcc -std=gnu99 -I/scratch/local/soft/lib64/R/include -DNDEBUG  -I/scratch/local/soft/include    -fpic  -g -O2  -c onload.c -o onload.o
gcc -std=gnu99 -I/scratch/local/soft/lib64/R/include -DNDEBUG  -I/scratch/local/soft/include    -fpic  -g -O2  -c openssh.c -o openssh.o
gcc -std=gnu99 -I/scratch/local/soft/lib64/R/include -DNDEBUG  -I/scratch/local/soft/include    -fpic  -g -O2  -c rand.c -o rand.o
gcc -std=gnu99 -I/scratch/local/soft/lib64/R/include -DNDEBUG  -I/scratch/local/soft/include    -fpic  -g -O2  -c read.c -o read.o
gcc -std=gnu99 -I/scratch/local/soft/lib64/R/include -DNDEBUG  -I/scratch/local/soft/include    -fpic  -g -O2  -c rsa.c -o rsa.o
gcc -std=gnu99 -I/scratch/local/soft/lib64/R/include -DNDEBUG  -I/scratch/local/soft/include    -fpic  -g -O2  -c signing.c -o signing.o
gcc -std=gnu99 -I/scratch/local/soft/lib64/R/include -DNDEBUG  -I/scratch/local/soft/include    -fpic  -g -O2  -c ssl.c -o ssl.o
gcc -std=gnu99 -I/scratch/local/soft/lib64/R/include -DNDEBUG  -I/scratch/local/soft/include    -fpic  -g -O2  -c stream.c -o stream.o
gcc -std=gnu99 -I/scratch/local/soft/lib64/R/include -DNDEBUG  -I/scratch/local/soft/include    -fpic  -g -O2  -c write.c -o write.o
gcc -std=gnu99 -shared -L/scratch/local/soft/lib/ -o openssl.so aes.o base64.o bignum.o cert.o diffie.o envelope.o error.o hash.o info.o keygen.o onload.o openssh.o rand.o read.o rsa.o signing.o ssl.o stream.o write.o -lssl -lcrypto
installing to /home/tmp/soft/lib64/R/library/openssl/libs

** R
** 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/tmp/soft/lib64/R/library/openssl/libs/openssl.so':
  /home/tmp/soft/lib64/R/library/openssl/libs/openssl.so: undefined symbol: EVP_PKEY_sign
Error: loading failed
Execution halted
ERROR: loading failed
jeroen commented 8 years ago

Right, the package is not even finding your pkg-config. Try:

Sys.setenv(PKG_CONFIG_PATH= "/scratch/local/soft/lib64/pkgconfig")
install.packages("openssl")

If this doesn't work, you can try this instead:

install.packages("openssl", configure.vars = "INCLUDE_DIR=/scratch/local/soft/include LIB_DIR=/scratch/local/soft/lib64")
vzemlys commented 8 years ago

Thanks a ton for your help. Now I get the following error:

/usr/bin/ld: /scratch/local/soft/lib64/libssl.a(s23_clnt.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/scratch/local/soft/lib64/libssl.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [openssl.so] Error 1

Maybe I should have used certain configuration for compiling openssl?

Thanks again for your help.

jeroen commented 8 years ago

It says you didn't compile libssl properly. You need to build with -fPIC

vzemlys commented 8 years ago

That did the trick! Thanks again.

agricolamz commented 5 years ago

Hi, I have the same problem... @jeroen, should I create a new issue?

system info installation details