jeroen / openssl

OpenSSL bindings for R
Other
65 stars 23 forks source link

Issue of loading "R-3.3.1/lib64/R/library/openssl/libs/openssl.so" #45

Closed JunHuang023 closed 7 years ago

JunHuang023 commented 7 years ago

Hi, I was trying to "devtools"

 install.packages("devtools")
   ...
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
    Error in dyn.load(file, DLLpath = DLLpath, ...) : 
      unable to load shared object '/host/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/git2r/libs/git2r.so':
      libssl.so.1.0.0: cannot open shared object file: No such file or directory

It seemed that I need to install "libssl.so.1.0.0", so I installed "openssl"

Jun@host ~]$ which openssl
~/Programme/openssl/bin/openssl
[Jun@host ~]$ ldd ~/Programme/openssl/bin/openssl
    linux-vdso.so.1 =>  (0x00007fffc3ead000)
    libssl.so.1.0.0 => /somewhere/Jun/Programme/openssl/lib/libssl.so.1.0.0 (0x00002b8027af9000)
    libcrypto.so.1.0.0 => /somewhere/Jun/Programme/openssl/lib/libcrypto.so.1.0.0 (0x00002b8027d5e000)
    libdl.so.2 => /lib64/libdl.so.2 (0x0000003cae000000)
    libc.so.6 => /lib64/libc.so.6 (0x0000003cad800000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003cad400000)

Then tried in to install "devtools" again:

install.packages("devtools", dependencies = TRUE) but the issue persisted:

 ...
 ** 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 '/misc/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/openssl/libs/openssl.so':
  /misc/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/openssl/libs/openssl.so: undefined symbol: EVP_PKEY_sign
Error: loading failed
Execution halted
...

Then I noticed the post here I tried:

Sys.setenv(PKG_CONFIG_PATH= "/somewhere/Jun/Programme/openssl/lib/pkgconfig")
install.packages("openssl")
installing to /misc/somewhere/Jun/Programme/R-3.3.1/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 '/misc/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/openssl/libs/openssl.so':
  /misc/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/openssl/libs/openssl.so: undefined symbol: EC_KEY_set_public_key_affine_coordinates
Error: loading failed

Then tried:

install.packages("openssl", configure.vars = "INCLUDE_DIR=/somewhere/Jun/Programme/openssl/include LIB_DIR=/somewhere/Jun/Programme/openssl/lib")
...
installing to /misc/somewhere/Jun/Programme/R-3.3.1/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 '/misc/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/openssl/libs/openssl.so':
  /misc/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/openssl/libs/openssl.so: undefined symbol: EC_KEY_set_public_key_affine_coordinates
Error: loading failed
...
wget https://cran.r-project.org/src/contrib/openssl_0.9.6.tar.gz
R CMD INSTALL openssl_0.9.6.tar.gz \
   --configure-vars='INCLUDE_DIR=/somewhere/Jun/Programme/openssl/include LIB_DIR=/somewhere/Jun/Programme/openssl/lib'
installing to /misc/somewhere/Jun/Programme/R-3.3.1/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 '/misc/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/openssl/libs/openssl.so':
  /misc/somewhere/Jun/Programme/R-3.3.1/lib64/R/library/openssl/libs/openssl.so: undefined symbol: EC_KEY_set_public_key_affine_coordinates

but without luck. When I checked

pkg-config --cflags openssl
-I/usr/kerberos/include  
 pkg-config --libs openssl
-L/usr/kerberos/lib64 -lssl -lcrypto -ldl -lz 

"pkg-config" seems to pointing wrong directory, when I checked "/usr/kerberos/" there are even no "/usr/kerberos/include " nor "/usr/kerberos/lib64"

cd /usr/kerberos/
/usr/kerberos]$ ls 
bin  man  sbin  share

there areno "/usr/kerberos/include " nor "/usr/kerberos/lib64", I assumed "libssl" installed in my directory would be used, it seemed that was not the case. the issue there seemed to be resolved. so this might be my personal issue. If any suggestion, please let me know. Thanks! PS:

$ cat /etc/*-release
CentOS release 5.10 (Final)
jeroen commented 7 years ago

Your initial issue indicates that the problem appears when loading git2r.so so this problem concerns the git2r package. It is not related to the openssl R package.

jeroen commented 7 years ago

CentOS 5 is really really old and ships with a version of libssl which is long deprecated. Your best bet is to uninstall openssl-devel from the system and compile a more recent version from source.

JunHuang023 commented 7 years ago

@jeroenooms . Thank you for your kind suggestion. Yes, the initial issue seemed to be problem when "loading git2r.so", after I installed "openssl" in my own directory:

Jun@host ~]$ which openssl
~/Programme/openssl/bin/openssl
[Jun@host ~]$ ldd ~/Programme/openssl/bin/openssl
    linux-vdso.so.1 =>  (0x00007fffc3ead000)
    libssl.so.1.0.0 => /somewhere/Jun/Programme/openssl/lib/libssl.so.1.0.0 (0x00002b8027af9000)
    libcrypto.so.1.0.0 => /somewhere/Jun/Programme/openssl/lib/libcrypto.so.1.0.0 (0x00002b8027d5e000)
    libdl.so.2 => /lib64/libdl.so.2 (0x0000003cae000000)
    libc.so.6 => /lib64/libc.so.6 (0x0000003cad800000)
    /lib64/ld-linux-x86-64.so.2 (0x0000003cad400000)

I am not sure that "git2r.so" issue has gone, but error messages changed into: openssl.so: undefined symbol: EVP_PKEY_sign or openssl.so: undefined symbol: EC_KEY_set_public_key_affine_coordinates seemed to suggest something is wrong with "openssl", which brought me here. "to uninstall openssl-devel from the system" might not be feasible for me, since I am not the administrator of our system. "compile a more recent version from source", It seemed to me that I had already done that,

wget https://www.openssl.org/source/old/1.0.0/openssl-1.0.0k.tar.gz
tar xvzf openssl-1.0.0k.tar.gz 
cd openssl-1.0.0k
./config --prefix=$HOME/Programme/openssl --openssldir=$HOME/Programme/ssl  
make && make install

I am not-well versed in programming/computer, so I might not get what you meant. If that is the case, please explain a little bit more. Thank you very much.