jeroen / openssl

OpenSSL bindings for R
Other
65 stars 23 forks source link

Installation Failure #77

Open taylorjtamu opened 4 years ago

taylorjtamu commented 4 years ago

I'm seeing an installation failure on one of our Linux systems. Just attempting a basic install.packages("openssl") and getting:

Error: package or namespace load failed for ‘openssl’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/home/xxxx/R/x86_64-redhat-linux-gnu-library/3.6/00LOCK-openssl/00new/openssl/libs/openssl.so':
  libssl.so.1.1: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/xxxx/R/x86_64-redhat-linux-gnu-library/3.6/openssl’

We're running Scientific Linux 7.7 (a RedHat downstream) openssl-devel is installed as version 1.0.2k release 19.el7 which is the latest version provided by yum for this OS version. Due to security policies we cannot downgrade. The files are located under /lib64/ and /usr/lib64/

$ openssl version
OpenSSL 1.0.2k-fips  26 Jan 2017
$ pkg-config --cflags --libs openssl
 -lssl -lcrypto
$ /sbin/ldconfig -p | grep libssl
        libssl3.so (libc6,x86-64) => /lib64/libssl3.so
        libssl.so.10 (libc6,x86-64) => /lib64/libssl.so.10
        libssl.so (libc6,x86-64) => /lib64/libssl.so

I've tested on a testing machine/instance with success. It's running the same version of libssl, so that shouldn't be the issue. On that machine:

$ ldconfig -p | grep libssl
        libssl3.so (libc6,x86-64) => /lib64/libssl3.so
        libssl.so.10 (libc6,x86-64) => /lib64/libssl.so.10

I do see that the machine with the failure has libssl.so and the test machine does not, but I've already checked for and removed the openssl098e compatibility package from the failing machine, and don't see any obvious other provider for libssl.so.

Could someone point me in the right direction on this issue? I can provide additional information if necessary.

dgfitch commented 4 years ago

Seeing a similar, possibly related issue on Scientific Linux when trying to install via renv. Compilation succeeds, and then it fails when testing dyn.load.

I'm not an R expert at all, just trying to get a method for a reproducible R environment using the includes the tidyverse, and this is a dependency.

** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘openssl’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object 'SNIP/renv/staging/1/00LOCK-openssl/00new/openssl/libs/openssl.so':
  SNIP/renv/staging/1/00LOCK-openssl/00new/openssl/libs/openssl.so: undefined symbol: OPENSSL_init_ssl

I've got a recent openssl compiled:

~ openssl version -a
OpenSSL 1.1.1h  22 Sep 2020
built on: Tue Sep 22 15:39:04 2020 UTC
platform: linux-x86_64
options:  bn(64,64) rc4(8x,int) des(int) idea(int) blowfish(ptr)
jeroen commented 4 years ago

This typically means you have multiple, conflicting openssl installations on your machine (probably one in /usr/lib/include provided by the system, and one in /usr/local/lib/include that you installed manually).

ayushnoori commented 3 years ago

@taylorjtamu @jeroen did you find any solution to this issue? We have run into the same challenge with an identical error. Our default system version of openssl did not have the openssl.pc file, hence we installed a second version of openssl, however this seemingly lead to the conflict. Using the following to do the install:

wget https://cran.r-project.org/src/contrib/openssl_1.4.3.tar.gz
R CMD INSTALL --configure-vars='PKG_CONFIG_PATH=/opt/puppetlabs/puppet/lib/pkgconfig/' openssl_1.4.3.tar.gz
jeroen commented 3 years ago

@ayushnoori what OS do you run? What error do you get?

ayushnoori commented 3 years ago

I am running CentOS 7.9.2009 (Kernel: Linux 3.10.0-1160.6.1.el7.x86_64). After running wget and R CMD INSTALL as detailed above, I receive the following error:

Error: package or namespace load failed for ‘openssl’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/usr/lib64/R/library/00LOCK-openssl/00new/openssl/libs/openssl.so':
  libssl.so.1.1: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/lib64/R/library/openssl’    
jeroen commented 3 years ago

It would be better if you compile against openssl-devel from CentOS instead of custom one. I'm sure that works. What error did you get when you tried that?

If you really, want to use your own libssl, I think you this first:

export LD_LIBRARY_PATH=/opt/puppetlabs/puppet/lib/
sudo ldconfig

Or I think you could also use R_LD_LIBRARY_PATH, see: https://cran.r-project.org/doc/manuals/r-release/R-admin.html

mjsspilka commented 3 years ago

Hi, Did anyone find a fix for this issue? I am experiencing the same problem trying to install the openssl package, and I have been unable to resolve it. I tried executing the suggested code in the error output and specifying the relevant directories on my machine:

R CMD INSTALL --configure-vars='INCLUDE_DIR=“/Users/canlab/miniconda3/pkgs/openssl-1.1.1l-h9ed2024_0/lib/pkgconfig/ LIB_DIR=“/Users/canlab/miniconda3/pkgs/openssl-1.1.1l-h9ed2024_0/lib/' openssl_1.4.5.tar.gz

However, I'm still getting the same error. Thank you for your help, Michael

ayushnoori commented 3 years ago

Hi Michael (@mjsspilka),

Looking back at my notes, I believed we found a resolution. This was some time ago, so cannot be sure. Please see my comments below:

  1. cd / then find . -iname "openssl.pc" to locate openssl.pc file.

  2. Start an R session:

Sys.setenv(LD_LIBRARY_PATH = "/opt/puppetlabs/puppet/lib")
Sys.setenv(PKG_CONFIG_PATH = "/opt/puppetlabs/puppet/lib/pkgconfig")
install.packages("openssl")

I hope this helps!

mjsspilka commented 3 years ago

That worked, thank you! Or at least I'm no longer getting errors related to installing openssl but unfortunately I'm still getting errors installing the other packages I need that seem to require openssl. Still, progress!

ayushnoori commented 3 years ago

Great! If, perchance, your error relates to xml2 or libxml2 (as mine once did), you may need to install the development version via:

yum install libxml2-devel
mjsspilka commented 3 years ago

Unfortunately, these errors appear different. Thanks though!