CMAKE安装,安装后未建立库
我知道有关此主题的七七二次答案,但是当然,我不了解它们。 [Linux | Ubuntu 20.04 | Cmake 3.23] 问题在于,在使用CMAKE构建共享库时,当我将此库链接到可执行文件时,该库会建立[用LDD命令测试]。但是,当我将项目安装在 /bin文件夹中时,无法在lib目录中找到我的库。
错误是:
./my_executable.exe: error while loading shared libraries: libCOOK.so: cannot open shared object file: No such file or directory
程序目录
src/
exes/
my_exe.f90
libraries/
COOK.c
安装目录
-lib/
libCOOK.so
-bin/
my_executable.exe
-include/
I know there are sevareal answers about this topic, but certainly, I do not understand them.
[Linux | ubuntu 20.04 | cmake 3.23]
The problem is that while building a shared library with cmake, when I link this library to an executable, the library is founded [tested with ldd command]. But when i install the project my executable in /bin folder, cant find my library in lib directory.
The error is:
./my_executable.exe: error while loading shared libraries: libCOOK.so: cannot open shared object file: No such file or directory
Program directory
src/
exes/
my_exe.f90
libraries/
COOK.c
Install directory
-lib/
libCOOK.so
-bin/
my_executable.exe
-include/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我自己的答案:
只需将install_directory/lib添加到ld_library_path
My own answer:
Just add the install_directory/lib to the LD_LIBRARY_PATH