CMAKE安装,安装后未建立库

发布于 2025-02-07 01:44:49 字数 556 浏览 3 评论 0原文

我知道有关此主题的七七二次答案,但是当然,我不了解它们。 [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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

上课铃就是安魂曲 2025-02-14 01:44:49

我自己的答案:
只需将install_directory/lib添加到ld_library_path

My own answer:
Just add the install_directory/lib to the LD_LIBRARY_PATH

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文