0

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

5
  • Looks like your dynamic loader (ld.so in Linux ) is not able to find the shared library you need. Commented Jun 22, 2016 at 20:14
  • 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 folder Commented Jun 22, 2016 at 20:19
  • Can you run the "ldd" command against your executable? It may give some clues... Commented Jun 22, 2016 at 20:24
  • Hey Greycon, I got the resolution by setting LD_LIBRARY_PATH in my .bashrc file, however I am not very excited with that solution Commented Jun 22, 2016 at 20:33
  • Ok cool. Did you try putting your .so into /usr/lib (as opposed to /usr/local/lib) ? Commented Jun 22, 2016 at 20:41

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

Cool..This worked, but there got to be a better way to do this I think...however temporarily I have placed the LD_LIBRARY_PATH in my .bashrc file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.