0
votes

I am facing strange issue while loading shared library in a cpp program. When the make file is executed then it works fine -

LIB_RELEASE = $(LIB)-lopencv_highgui -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -lmmcheng_github -lgomp

But when I run this using the output file which is generated as a result of this make file, it gives me error as -

./bin/mmcheng_densecut: error while loading shared libraries: libmmcheng_github.so: cannot open shared object file: No such file or directory

PS I have placed the libmmcheng_github.so in the folder /usr/local/lib

Error Screenshot - See during makefile all works fine however later it fails

Thanks

1
Looks like your dynamic loader (ld.so in Linux ) is not able to find the shared library you need.Jan Korous
Yeah that I can also see in the error but what should I do to resolve this. I used to have this file in my current folder however due to this error i moved it to the /usr/local/lib foldercodeomnitrix
Can you run the "ldd" command against your executable? It may give some clues...Greycon
Hey Greycon, I got the resolution by setting LD_LIBRARY_PATH in my .bashrc file, however I am not very excited with that solutioncodeomnitrix
Ok cool. Did you try putting your .so into /usr/lib (as opposed to /usr/local/lib) ?Greycon

1 Answers

1
votes

Try setting LD_LIBRARY_PATH environment string, read here

Although this is discouraged practice but at least it will help you make one step forward...

also, read this question and answer