Wednesday, February 23, 2022

[SOLVED] my own .so lib Ubuntu->Debian migration (cannot open shared library)

Issue

Recently i migrated my self from Ubuntu to Debian, (fortunetly didn't delete old OS) On Ubuntu I had written litle library called

libmyh.so

I've used it in other app by

g++ (...) -lmyh -L../codeSamples/myh/lib

and it ran perfectly, but on Debian witch this same makefile i get:

./GLUI.out: error while loading shared libraries: libmyh.so: cannot open shared object file: No such file or directory

any clue wat could be wrong?


Solution

.so files are not linked by g++, because they are not static libraries (which end with .a) or compilation objects (.o).

Instead, set the path from where to load dynamic libraries:

export LD_LIBRARY_PATH=/path/to/codeSamples/myh/lib
./GLUI.out

As this is not related to Debian vs Ubuntu, I think you have set this variable on your Ubuntu system but not on the Debian one.



Answered By - Valentin Lorentz
Answer Checked By - Katrina (WPSolving Volunteer)