jeroen / openssl

OpenSSL bindings for R
Other
63 stars 20 forks source link

Installation error (0.9.6) #39

Closed pkq closed 7 years ago

pkq commented 7 years ago

Attempting to update from 0.9.5 - 0.9.6, I get the following error message at the end of the install process:

** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared object '~/Library/R/3.3/library/openssl/libs/openssl.so':
  dlopen(~/Library/R/3.3/library/openssl/libs/openssl.so, 6): Symbol not found: _DSA_get0_key
  Referenced from: ~/Library/R/3.3/library/openssl/libs/openssl.so
  Expected in: flat namespace
 in ~/Library/R/3.3/library/openssl/libs/openssl.so
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘~/Library/R/3.3/library/openssl’
* restoring previous ‘~/Library/R/3.3/library/openssl’

Any suggestions? Thanks!

jeroen commented 7 years ago

This can happen when you have multiple (conflicting) versions of libssl installed on your system. What operating system do you run? How did you install libssl?

pkq commented 7 years ago

Thanks, that was indeed the problem. On OS X 10.11.6, I had both openssl and openssl@1.1 installed via Homebrew. I don't think I'd installed either explicitly, but mongodb and ruby-build required the former, and nginx the latter. Running brew uninstall --ignore-dependencies openssl@1.1 solved the installation issue, but now I'm wondering if I've opened myself up to other problems down the line?

M2shad0w commented 7 years ago

是 系统中有多个版本的 openssl 引起的,删除 brew 安装的 openssl

tdsmith commented 7 years ago

This proves to be a bad interaction between these lines in the Homebrew formula: https://github.com/Homebrew/homebrew-science/blob/master/r.rb#L115-L119

    %w[gettext readline openssl].each do |f|
      ENV.append "CPPFLAGS", "-I#{Formula[f].opt_include}"
      ENV.append "LDFLAGS", "-L#{Formula[f].opt_lib}"
    end

and these lines in your configure script:

PKG_CFLAGS="-I$BREWDIR/opt/openssl@1.1/include -I$BREWDIR/opt/openssl/include"
PKG_LIBS="-L$BREWDIR/opt/openssl@1.1/lib -L$BREWDIR/opt/openssl/lib $PKG_LIBS"

which end up compiling like this:

clang -I/usr/local/Cellar/r/3.3.2/R.framework/Resources/include -DNDEBUG -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/openssl/include -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include -fPIC -g -O2 -c aes.c -o aes.o

and linking like this:

clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/Cellar/r/3.3.2/R.framework/Resources/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib -L/usr/local/lib -o openssl.so aes.o base64.o bignum.o cert.o compatibility.o diffie.o envelope.o error.o hash.o info.o keygen.o keys.o onload.o openssh.o password.o pem.o pkcs12.o pkcs7.o rand.o rsa.o signing.o ssl.o stream.o write.o -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/openssl/lib -lssl -lcrypto -F/usr/local/Cellar/r/3.3.2/R.framework/.. -framework R -lintl -Wl,-framework -Wl,CoreFoundation

This winds up finding the openssl 1.1 headers and the openssl 1.0.2 libraries which makes for a sad day.

jeroen commented 7 years ago

@tdsmith which version of R do you use? Where does this linking line come from?

-L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib

My version of R does not link to any libssl by default...

Also homebrew should usually stop you from installing both openssl@1.1 and openssl on the same machine. I'm not sure what would be a good solution here....

tdsmith commented 7 years ago

Homebrew's R distribution. It comes from the flags added to the Homebrew formula to help packages for the brewed R find openssl by default. Perhaps they are no longer necessary.

Homebrew supports parallel 1.0.2 and 1.1 installations normally.

On Sat, Feb 25, 2017, 01:32 Jeroen Ooms notifications@github.com wrote:

@tdsmith https://github.com/tdsmith which version of R do you use? Where does this linking line come from?

-L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib

My version of R does not link to any libssl by default...

Also homebrew should usually stop you from installing both openssl@1.1 and openssl on the same machine. I'm not sure what would be a good solution here....

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jeroenooms/openssl/issues/39#issuecomment-282472657, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKnQR-jwmsCpfC92fntyVAz-Y2OA-B3ks5rf_VKgaJpZM4LjrSo .

jeroen commented 7 years ago

@tdsmith I think this should be fixed via https://github.com/jeroenooms/openssl/commit/1e35b71b2ac9b4dab6798a683b9c904f6324fda3. Can you please confirm?

jeroen commented 7 years ago

Assuming this is fixed now.

achekroud commented 7 years ago

@tdsmith I just came across the same problem with homebrew's r distribution -- did you ever raise it as an issue? if not then maybe we should let them know

jeroen commented 7 years ago

Does it still happen in the dev versoin?

devtools::install_github("jeroen/openssl")
achekroud commented 7 years ago

yep :(

initially, to fix it, I ran brew uninstall --ignore-dependencies openssl@1.1 and then reinstalled the R package as normal.

I then ran brew install openssl@1.1 to reinstall the problematic openssl, ran without error

I then went back into R and ran devtools::install_github("jeroen/openssl")

same error as before:

> devtools::install_github("jeroen/openssl")
Downloading GitHub repo jeroen/openssl@master
from URL https://api.github.com/repos/jeroen/openssl/zipball/master
Installing openssl
'/usr/local/Cellar/r/3.3.3/R.framework/Resources/bin/R'  \
  --no-site-file --no-environ --no-save --no-restore --quiet CMD  \
  INSTALL  \
  '/private/var/folders/_f/7513qsp16cs5w816gpf_3hxm0000gn/T/RtmpNSdl69/devtools76c951fad084/jeroen-openssl-6dee2ec'  \
  --library='/usr/local/lib/R/3.3/site-library' --install-tests 

* installing *source* package ‘openssl’ ...

[removed a bunch of black clang output]

installing to /usr/local/lib/R/3.3/site-library/openssl/libs
** R
** inst
** tests
** 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 '/usr/local/lib/R/3.3/site-library/openssl/libs/openssl.so':
  dlopen(/usr/local/lib/R/3.3/site-library/openssl/libs/openssl.so, 6): Symbol not found: _DSA_get0_key
  Referenced from: /usr/local/lib/R/3.3/site-library/openssl/libs/openssl.so
  Expected in: flat namespace
 in /usr/local/lib/R/3.3/site-library/openssl/libs/openssl.so
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/3.3/site-library/openssl’
* restoring previous ‘/usr/local/lib/R/3.3/site-library/openssl’
Error: Command failed (1)

heres the sessioninfo

> sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-apple-darwin16.4.0 (64-bit)
Running under: macOS Sierra 10.12.3

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] httr_1.2.1      R6_2.2.0        tools_3.3.3     withr_1.0.2    
 [5] curl_2.3        memoise_1.0.0   knitr_1.15.1    git2r_0.18.0   
 [9] digest_0.6.12   devtools_1.12.0
tdsmith commented 7 years ago

Sorry, I was distracted by my thesis, which is now submitted. :tada: I'm probably the relevant Homebrew person to complain to.

The workaround doesn't apply the versioned library flag on my system either:

* installing *source* package ‘openssl’ ...
Homebrew 1.1.11-67-gb7e7b5b
Homebrew/homebrew-core (git revision 260a17; last commit 2017-03-18)
Using PKG_CFLAGS=-I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/openssl/include
Using PKG_LIBS=-L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/openssl/lib -lssl -lcrypto

It's failing because soname.exe is spitting out 1.0.0 and not 1.1.

It works if you swap PKG_CFLAGS and CPPFLAGS in the clang invocation that produces soname, i.e.:

${CC} ${PKG_CFLAGS} ${CPPFLAGS} ${CFLAGS} src/tests/soname.c -o ${TMPDIR}/soname.exe

achekroud commented 7 years ago

@tdsmith congratulations!!! i'm coming toward the end of my phd so i feel your pain.

achekroud commented 7 years ago

also, just checked out your site - looks like you've worked on a bunch of cool things. are you looking for a job in nyc by any chance? we're hiring full-stack engineers at www.spring.care!

tdsmith commented 7 years ago

I have plans but I appreciate the thought; good luck with the company & your work!

tdsmith commented 7 years ago

Are there other popular R bindings for openssl? If this is the package everyone uses (Google suggests that it is) then I should have Homebrew just remove those flags.

achekroud commented 7 years ago

Pretty sure this is the one everyone uses!

Adam Chekroud (mobile)

On 18 Mar 2017, at 21:42, Tim D. Smith notifications@github.com wrote:

Are there other popular R bindings for openssl? If this is the package everyone uses (Google suggests that it is) then I should have Homebrew just remove those flags.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

fangling0913 commented 5 years ago

When I install Seurat (a scRNA-seq package), it always give the error. Can someone helps me:

** 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 '/software/R-3.6.1/lib64/R/library/00LOCK-openssl/00new/openssl/libs/openssl.so': /software/R-3.6.1/lib64/R/library/00LOCK-openssl/00new/openssl/libs/openssl.so: undefined symbol: RSA_set0_factors Error: loading failed Execution halted ERROR: loading failed

The downloaded source packages are in ‘/tmp/RtmppRwLjA/downloaded_packages’ Updating HTML index of packages in '.Library' Making 'packages.html' ... done Warning messages: 1: In install.packages("Seurat") : installation of package ‘openssl’ had non-zero exit status 2: In install.packages("Seurat") : installation of package ‘httr’ had non-zero exit status 3: In install.packages("Seurat") : installation of package ‘plotly’ had non-zero exit status 4: In install.packages("Seurat") : installation of package ‘Seurat’ had non-zero exit status

jeroen commented 5 years ago

@fangling0913 This can happen when you have multiple (conflicting) versions of libssl installed on your system. What operating system do you run? How did you install libssl?

fangling0913 commented 5 years ago

@jeroen The system is Centos7 (docker image). It was build by others. I don't know how he install libssl. But the libssl is indeed in the system.

ldconfig -p|grep ssl libssl3.so (libc6,x86-64) => /lib64/libssl3.so libssl.so.46 (libc6,x86-64) => /usr/local/lib/libssl.so.46 libssl.so.45 (libc6,x86-64) => /usr/local/lib/libssl.so.45 libssl.so.10 (libc6,x86-64) => /lib64/libssl.so.10 libssl.so (libc6,x86-64) => /usr/local/lib/libssl.so libssl.so (libc6,x86-64) => /lib64/libssl.so

jeroen commented 5 years ago

Yes so the problem is you have 3 different versions of openssl installed on the system. You're compiling against another version that you link to.

I recommend you either remove the one under /usr/local/ that you compiled manually:

sudo rm -Rf /usr/local/include/openssl
sudo rm -Rf /usr/local/lib/libssl*
sudo rm -Rf /usr/local/lib/libcrypto*

Alternatively remove the system version of openssl: sudo yum remove openssl. If you don't have permissions to remove versions of libssl on the system, try this:

Sys.setenv(LD_LIBRARY_PATH = "/usr/local/lib")
Sys.setenv(PKG_CONFIG_PATH = "/usr/local/lib/pkgconfig")
install.packages("openssl")
fangling0913 commented 5 years ago

@jeroen sudo yum remove openssl It works for me. Thanks!

swvanderlaan commented 4 years ago

Hi,

I have a problem with openssl@1.1 installed via homebrew - uninstalling is not an option since a lot of other things depend on it. Here are my details.

The R message.

R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin19.4.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> BiocManager::install("minfi")
Bioconductor version 3.9 (BiocManager 1.30.10), R 3.6.3 (2020-02-29)
Installing package(s) 'minfi'
trying URL 'https://bioconductor.org/packages/3.9/bioc/src/contrib/minfi_1.30.0.tar.gz'
Content type 'application/x-gzip' length 505136 bytes (493 KB)
==================================================
downloaded 493 KB

* installing *source* package ‘minfi’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared object '/usr/local/lib/R/3.6/site-library/openssl/libs/openssl.so':
  dlopen(/usr/local/lib/R/3.6/site-library/openssl/libs/openssl.so, 6): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /usr/local/lib/R/3.6/site-library/openssl/libs/openssl.so
  Reason: image not found
Calls: <Anonymous> ... asNamespace -> loadNamespace -> library.dynam -> dyn.load
Execution halted
ERROR: lazy loading failed for package ‘minfi’
* removing ‘/usr/local/lib/R/3.6/site-library/minfi’
* restoring previous ‘/usr/local/lib/R/3.6/site-library/minfi’

The downloaded source packages are in
    ‘/private/var/folders/kc/c5rw4cb94c1c149gsm2ygfc00000gn/T/RtmpmoOitT/downloaded_packages’
Warning message:
In install.packages(...) :
  installation of package ‘minfi’ had non-zero exit status

The brew configuration:

brew info openssl@1.1
openssl@1.1: stable 1.1.1g (bottled) [keg-only]
Cryptography and SSL/TLS Toolkit
https://openssl.org/
/usr/local/Cellar/openssl@1.1/1.1.1g (8,059 files, 18MB)
  Poured from bottle on 2020-04-25 at 23:38:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/openssl@1.1.rb
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl@1.1/certs

and run
  /usr/local/opt/openssl@1.1/bin/c_rehash

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.

If you need to have openssl@1.1 first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> /Users/swvanderlaan/.bash_profile

For compilers to find openssl@1.1 you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

For pkg-config to find openssl@1.1 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

==> Analytics
install: 937,533 (30 days), 2,132,871 (90 days), 5,339,948 (365 days)
install-on-request: 150,175 (30 days), 321,998 (90 days), 745,982 (365 days)
build-error: 0 (30 days)

swvanderlaan@Sanders-MBP ~
$ brew uninstall openssl@1.1
Error: Refusing to uninstall /usr/local/Cellar/openssl@1.1/1.1.1g
because it is required by cairo, cask, dmtx-utils, emacs, ffmpeg, gdal, gdk-pixbuf, geos, glib, gnutls, harfbuzz, imagemagick, ipython, jupyterlab, krb5, libass, libdap, libevent, libgit2, libheif, libpq, libspatialite, libssh2, libxml2, mariadb-connector-c, mysql, mysql-client, numpy, opencv@2, openslide, poppler, python, python@2, python@3.8, rtmpdump, shared-mime-info, srt, tbb, ufraw, unbound, wget, wmctrl, wxpython and zbar, which are currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies openssl@1.1

Any suggestions on how to solve this?

jeroen commented 4 years ago

You need to reinstall the openssl package in r.

swvanderlaan commented 4 years ago

I figured that too and that worked! Hence the delay in answering... plus #covid19.

zekunyang commented 3 years ago

When I install Seurat (a scRNA-seq package), it always give the error. Can someone helps me:

compilation terminated. make: *** [/usr/R-4.0.5/lib64/R/etc/Makeconf:172: read.o] Error 1 ERROR: compilation failed for package ‘png’

The downloaded source packages are in ‘/tmp/Rtmpxke5Gh/downloaded_packages’ Updating HTML index of packages in '.Library' Making 'packages.html' ... done Warning messages: 1: In install.packages("Seurat") : installation of package ‘openssl’ had non-zero exit status 2: In install.packages("Seurat") : installation of package ‘igraph’ had non-zero exit status 3: In install.packages("Seurat") : installation of package ‘png’ had non-zero exit status 4: In install.packages("Seurat") : installation of package ‘httr’ had non-zero exit status 5: In install.packages("Seurat") : installation of package ‘leiden’ had non-zero exit status 6: In install.packages("Seurat") : installation of package ‘plotly’ had non-zero exit status 7: In install.packages("Seurat") : installation of package ‘Seurat’ had non-zero exit status