linux - 运行程序时无法加载共享库

标签 linux shared-libraries

我在 cpp 程序中加载共享库时遇到奇怪的问题。当执行 make 文件时,它工作正常 -

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

但是当我使用由这个 make 文件生成的输出文件运行它时,它给我的错误是 -

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

PS 我已经将 libmmcheng_github.so 放在文件夹/usr/local/lib 中

错误截图 - See during makefile all works fine however later it fails

谢谢

最佳答案

尝试设置LD_LIBRARY_PATH 环境字符串,读取here

虽然这是discouraged practice但至少它会帮助你向前迈出一步......

另请阅读 this question and answer

关于linux - 运行程序时无法加载共享库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37977381/

相关文章:

c++ - 编译失败,出现 "relocation R_X86_64_32 against ` .rodata.str1。 8' can not be used when making a shared object"

linux - SHA-256 测试向量

linux - 由于 crontab 被锁定在 Raspberry Pi 之外

linux - HAProxy tcp方式源客户端ip

python - Linux 上的 MATLAB MEX 文件无法在 libpython.2.7.so 中找到符号

java - 使用代码块创建共享对象?

linux - 如何从shell检测wget的下载速度为零

linux - parport_driver.attach() 何时被调用?

c++ - 从客户端应用程序调试动态库

c++ - 如何创建一个自动链接到动态库的静态库?