Ruby comes up with LoadErrors I do not understand. It complains about opening a shared object file, while it's present.
irb(main):001:0> require 'openssl'
LoadError: libssl.so.1.0.0: cannot open shared object file: No such file or directory - /usr/lib/ruby/2.3.0/x86_64-linux/openssl.so
    from /usr/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/lib/ruby/2.3.0/openssl.rb:13:in `<top (required)>'
    from /usr/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
but ls /usr/lib/ruby/2.3.0/x86_64-linux/openssl.so
returns the file /usr/lib/ruby/2.3.0/x86_64-linux/openssl.so
Load Path:
irb(main):001:0> pp $LOAD_PATH
["/usr/lib/ruby/site_ruby/2.3.0",
 "/usr/lib/ruby/site_ruby/2.3.0/x86_64-linux",
 "/usr/lib/ruby/site_ruby",
 "/usr/lib/ruby/vendor_ruby/2.3.0",
 "/usr/lib/ruby/vendor_ruby/2.3.0/x86_64-linux",
 "/usr/lib/ruby/vendor_ruby",
 "/usr/lib/ruby/2.3.0",
 "/usr/lib/ruby/2.3.0/x86_64-linux"]
Another example, with the rails gem installed, generating a new project fails with following LoadError.
/usr/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:120:in `require': libcrypto.so.1.0.0: cannot open shared object file: No such file or directory - /usr/lib/ruby/2.3.0/x86_64-linux/digest/md5.so (LoadError)
And again, doing ls /usr/lib/ruby/2.3.0/x86_64-linux/digest/md5.so shows the presence of the file.
my ruby version is ruby 2.3.1p112.
In case you wonder, uname -m returns x86_64.
I must miss something obvious, I guess. Any hints popping up are much appreciated!
Thanks to jordanm's comment, I was able to solve the issue!
The issue was related to openssl. ldd prints shared object dependencies and revealed the missing libraries.
ldd /usr/lib/ruby/2.3.0/x86_64-linux/openssl.so
...
libssl.so.1.0.0 => not found
libcrypto.so.1.0.0 => not found
...
After installing openssl-1.0 package, (while openssl v1.1.0 package was installed), the output of the same command looks better:
libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x00007faddac8f000)
libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x00007fadda814000)
and now, I'm able to require 'openssl' as well as generating a new rails project.
But after all, shouldn't ruby complain about missing packages, or should openssl-1.0 be at least a dependency of rails?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With