我自己的 .so lib Ubuntu->Debian 迁移(无法打开共享库)
my own .so lib Ubuntu->Debian migration (cannot open shared library)
最近我将自己从 Ubuntu 迁移到 Debian,(幸运的是没有删除旧的 OS)
在 Ubuntu 我写了一个名为
的小库
libmyh.so
我在
的其他应用程序中使用过它
g++ (...) -lmyh -L../codeSamples/myh/lib
它 运行 完美,但在 Debian 上我得到了同样的 makefile:
./GLUI.out: error while loading shared libraries: libmyh.so: cannot open shared object file: No such file or directory
有什么线索是错的吗?
.so
文件不被 g++ 链接,因为它们不是静态库(以 .a
结尾)或编译对象(.o
)。
改为设置加载动态库的路径:
export LD_LIBRARY_PATH=/path/to/codeSamples/myh/lib
./GLUI.out
因为这与 Debian 和 Ubuntu 无关,我想你已经在你的 Ubuntu 系统上设置了这个变量,但没有在 Debian 系统上设置。
最近我将自己从 Ubuntu 迁移到 Debian,(幸运的是没有删除旧的 OS) 在 Ubuntu 我写了一个名为
的小库libmyh.so
我在
的其他应用程序中使用过它g++ (...) -lmyh -L../codeSamples/myh/lib
它 运行 完美,但在 Debian 上我得到了同样的 makefile:
./GLUI.out: error while loading shared libraries: libmyh.so: cannot open shared object file: No such file or directory
有什么线索是错的吗?
.so
文件不被 g++ 链接,因为它们不是静态库(以 .a
结尾)或编译对象(.o
)。
改为设置加载动态库的路径:
export LD_LIBRARY_PATH=/path/to/codeSamples/myh/lib
./GLUI.out
因为这与 Debian 和 Ubuntu 无关,我想你已经在你的 Ubuntu 系统上设置了这个变量,但没有在 Debian 系统上设置。