Loaderror - Cannot Open Shared Object File - File Is Present, But It Says No Such File

LoadError - cannot open shared object file - file is present, but it says no such file

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?

libffi.so.6: cannot open shared object file in rails

Ubuntu 20.04 upgraded libffi6 to libffi7 but your Rails apps are still looking for libffi6.
You need to run the following command:

gem pristine ffi

This should fix it

cannot open shared object file: No such file or directory error while there is file

GCC's ld command has an --rpath option that may solve your problems:

-rpath=dir
Add a directory to the runtime library search path.

You should add the location of your compiled library to GCC's command line when you compile prog, via the -wl option:

-Wl,option
Pass option as an option to the linker. If option contains commas,
it is split into multiple options at the commas.

So your search path already includes /opt/lib because of the original creation of the library:

-Wl,-rpath,/opt/lib

For the second compile, add the location of libctest.so.1.0 as another rpath, and it should be found without your needing to move files around:

gcc -Wall -L/opt/lib main.c -lctest -Wl,-rpath,/you/dir/name -o prog

I think your original effort is failing as the linker has included a hard path to your original outout dir, and then you moved the library from under it.

libMagickCore.so.4: cannot open shared object file: No such file or directory

When you upgrade you can lose the reference to library file in a compiled gem. To resolve this just recompile the gem (the rmagick gem in this case). Depending on your server setup you can do this with
gem pristine rmagick
or
bundle exec gem pristine rmagick when using bundler.



Related Topics



Leave a reply



Submit