Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot open shared object file: No such file or directory

Tags:

c++

I met the share library not found on the head node of a cluster with torch. I have built the library as well as specify the correct path of the library while compiling my own program "absurdity" by g++. So it looks strange to me. Any idea? Thanks and regards!

[tim@user1 release]$ make   ...   ...   g++ -pipe -W -Wall -fopenmp -ggdb3 -O2    -I/home/tim/program_files/ICMCluster/ann_1.1.1/include -I/home/tim/program_files/ICMCluster/libsvm-2.89  -I/home/tim/program_files/ICMCluster/svm_light  -o absurdity  xxxxxx.o  -L/home/tim/program_files/ICMCluster/ann_1.1.1/release/lib -L/home/tim/program_files/ICMCluster/libsvm-2.89/release/lib -L/home/tim/program_files/ICMCluster/svm_light/release/lib -lm -ljpeg -lpng -lz -lANN -lpthread -lsvm -lsvmlight    [tim@user1 release]$ ./absurdity   ./absurdity: error while loading shared libraries: libsvmlight.so: cannot open shared object file: No such file or directory    [tim@user1 release]$ ls /home/tim/program_files/ICMCluster/svm_light/release/lib/libsvmlight.so -l   -rwxr-xr-x 1 tim Brown 121407 Jan 31 12:14 /home/tim/program_files/ICMCluster/svm_light/release/lib/libsvmlight.so   [tim@user1 release]$ LD_LIBRARY_PATH= /home/tim/program_files/ICMCluster/svm_light/release/lib:$LD_LIBRARY_PAT     [tim@user1 release]$ export LD_LIBRARY_PATH   [tim@user1 release]$ ./absurdity   ./absurdity: error while loading shared libraries: libsvmlight.so: cannot open shared object file: No such file or directory    [tim@user1 release]$ ls  /home/tim/program_files/ICMCluster/svm_light/release/lib   libsvmlight.a  libsvmlight.so   
like image 275
Tim Avatar asked Jan 31 '10 17:01

Tim


People also ask

How do you fix Cannot open shared object file no such file or directory?

Fix ing 'cannot open shared object file: No such file or directory' error. One quick way to fix this “error while loading shared libraries” automatically is to use ldconfig. This one liner should solve the problem in most cases.

How do you open .so file in Linux?

How to Open a SO File. SO files can technically be opened with GNU Compiler Collection but these types of files aren't intended to be viewed or used like you might another type of file. Instead, they're just placed in an appropriate folder and used automatically by other programs via Linux's dynamic link loader.

How do I open a shared library in Linux?

You need to run the ldconfig command to effect the changes. After creating your shared library, you need to install it. You can either move it into any of the standard directories mentioned above and run the ldconfig command.

What is Ldconfig command?

The Linux ldconfig command creates, updates, and removes available symbolic links for currently shared libraries. The symbolic links are based on lib directories in /etc/ld. so. conf. Linux commands rely on shared libraries.


2 Answers

Copied from my answer here: https://stackoverflow.com/a/9368199/485088

Run ldconfig as root to update the cache - if that still doesn't help, you need to add the path to the file ld.so.conf (just type it in on its own line) or better yet, add the entry to a new file (easier to delete) in directory ld.so.conf.d.

like image 110
Tim Čas Avatar answered Oct 12 '22 00:10

Tim Čas


Your LD_LIBRARY_PATH doesn't include the path to libsvmlight.so.

$ export LD_LIBRARY_PATH=/home/tim/program_files/ICMCluster/svm_light/release/lib:$LD_LIBRARY_PATH 
like image 30
Maurits Rijk Avatar answered Oct 11 '22 23:10

Maurits Rijk