63

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  
Tim
  • 1
  • 141
  • 372
  • 590

4 Answers4

100

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.

Community
  • 1
  • 1
Tim Čas
  • 10,501
  • 3
  • 26
  • 32
82

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
rkosegi
  • 14,165
  • 5
  • 50
  • 83
Maurits Rijk
  • 9,789
  • 2
  • 36
  • 53
21
sudo ldconfig

ldconfig creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.so.conf, and in the trusted directories (/lib and /usr/lib).

Generally package manager takes care of this while installing the new library, but not always (specially when you install library with cmake).

And if the output of this is empty

$ echo $LD_LIBRARY_PATH

Please set the default path

$ LD_LIBRARY_PATH=/usr/local/lib
Shravan40
  • 8,922
  • 6
  • 28
  • 48
4

When working on a supercomputer, I received this error when I ran:

module load python/3.4.0
screen
python

To resolve the error, I simply needed to reload the module in the screen terminal:

module load python/3.4.0
python
duhaime
  • 25,611
  • 17
  • 169
  • 224