Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenSSL can't load library with gem rubygems or brew or bundle

I use brew 0.9.5, which with I installed rbenv 0.4.0 and ruby-build for a ruby 2.1.2.

Haven't touched anything since a while, and after few osx updates :

 bundle

Gives :

/usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/digest/sha1.bundle, 9): Library not loaded: @@HOMEBREW_PREFIX@@/opt/openssl/lib/libcrypto.1.0.0.dylib (LoadError)
  Referenced from: /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/digest/sha1.bundle
  Reason: image not found - /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/digest/sha1.bundle
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/definition.rb:1:in `<top (required)>'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler.rb:153:in `definition'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/cli/install.rb:76:in `run'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/cli.rb:146:in `install'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/vendor/thor/command.rb:27:in `run'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/vendor/thor.rb:363:in `dispatch'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/vendor/thor/base.rb:440:in `start'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/cli.rb:9:in `start'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/bin/bundle:20:in `block in <top (required)>'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
    from /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bundler-1.6.3/bin/bundle:20:in `<top (required)>'
    from /usr/local/Cellar/rbenv/versions/2.1.2/bin/bundle:23:in `load'
    from /usr/local/Cellar/rbenv/versions/2.1.2/bin/bundle:23:in `<main>'

I tried brew uninstall openssl && brew install openssl.

I tried brew link openssl --force.

I tried to upgrade everything.

Nothing had worked so far.

I can't launch puma, bundle or update gems.

gem update --system

ERROR:  Loading command: update (LoadError)
    dlopen(/usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle, 9): Library not loaded: @@HOMEBREW_PREFIX@@/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle
  Reason: image not found - /usr/local/Cellar/rbenv/versions/2.1.2/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass

gem -v : 2.4.0

brew --env

HOMEBREW_CC: clang
HOMEBREW_CXX: clang++
MAKEFLAGS: -j4
CMAKE_PREFIX_PATH: /usr/local
CMAKE_INCLUDE_PATH: /usr/include/libxml2:/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
CMAKE_LIBRARY_PATH: /System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig:/usr/local/Library/ENV/pkgconfig/10.9
ACLOCAL_PATH: /usr/local/share/aclocal
PATH: /usr/local/Library/ENV/4.3:/usr/bin:/bin:/usr/sbin:/sbin


brew config

HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew.git
HEAD: 49e6d09f85a999a4a4d82b2d47bd837ed342d8cb
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit haswell
OS X: 10.9.5-x86_64
CLT: 6.0.0.0.1.1410400753
Clang: 6.0 build 600
X11: 2.7.6 => /opt/X11
System Ruby: 2.0.0-481
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/local/Cellar/rbenv/shims/ruby

brew uses --installed openssl
postgresql  ruby-build

If anyone have a clue... I'll take it !

like image 358
gdurelle Avatar asked Sep 20 '14 08:09

gdurelle


1 Answers

Not sure why and how but :

rbenv install 2.1.2
rbenv: /usr/local/Cellar/rbenv/versions/2.1.2 already exists
continue with installation? (y/N) y

And now it works ! Just had to reinstall my ruby, like it did re-link openssl with it someway...

I can work again now, but just so I know more what happens, if someone know the under-the-hood mecanisms, I'll be glad to hear it.

like image 81
gdurelle Avatar answered Nov 16 '22 00:11

gdurelle