Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error while loading shared libraries: libcaffe.so

Tags:

c++

caffe

I am trying to write a simple c++ application which uses caffe.

This is part of my makefile:

 FLAGS := -I/usr/local/cuda/include -I/home/guinness/GamerIA/Caffe/caffe  /include/ -I/home/guinness/GamerIA/Caffe/caffe/src/ -I$(ALE)/src -I$(ALE)/src/controllers -I$(ALE)/src/os_dependent -I$(ALE)/src/environment -I$(ALE)/src/external -L$(ALE) -L../Caffe/caffe/build/lib -L/usr/local/cuda/lib64/ -L/usr/lib/x86_64-linux-gnu
 CXX := g++ -std=c++11
 INC:= GAImage.cpp GAScreen.cpp GABrain.cpp
 FILE := main 
 LDFLAGS := -lale -lz -lpthread -lglog -lprotobuf -lleveldb -lsnappy -lboost_system -lhdf5_hl -lhdf5 -lopencv_core -lopencv_highgui -lopencv_imgproc -lcblas -lboost_python -lpython2.7 -lcudart -lcublas -lcurand -lcudnn -lcaffe 

The program compiles succesfully but when I try to run the result I get the following error:

 error while loading shared libraries: libcaffe.so: cannot open shared object file: No such file or directory

But the file is clearly at the location: ../Caffe/caffe/build/lib which I have included. Can anyone help me out here?

like image 839
DalekSupreme Avatar asked Oct 31 '22 20:10

DalekSupreme


1 Answers

When you link, it includes a little note in the executable to the dynamic linker that “hey, I need libcaffe.so!” but it doesn’t say where to find it. When you run the program, you may need to give the dynamic linker some extra information, saying “hey, when you’re looking for libraries, check here too!”, and you can do by setting the LD_LIBRARY_PATH environment variable to the directory containing libcaffe.so before running your program.

like image 168
icktoofay Avatar answered Nov 15 '22 04:11

icktoofay