哪个链接器设置决定共享库的加载路径?

发布于 2024-09-28 23:13:54 字数 809 浏览 1 评论 0原文

我在 Mac 上构建了 Poco C++ 库。检查构建的输出文件时,我注意到它们的加载路径是指向构建目录的绝对路径。例如:

$ otool -L libPocoFoundation.dylib
libPocoFoundation.dylib:
    /Users/francis/orig/poco-1.3.6p2/lib/Darwin/i386/libPocoFoundation.9.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)
    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 625.0.0)

哪个编译器或链接器选项决定了这一点?我怎样才能覆盖这个? (在编译时。我知道之后可以使用install_name_tool更改它。)

编辑
编译器是g++-4.0(gcc版本4.0.1 Apple)。
链接器是 libtool (Apple Computer, Inc. 版本 cctools-782)

我当前正在仔细阅读 makefile。也许我会自己解决。但欢迎所有帮助!

I have built the Poco C++ library on Mac. When inspecting the built output files I notice that their load paths are absolute paths that point to the build directory. For example:

$ otool -L libPocoFoundation.dylib
libPocoFoundation.dylib:
    /Users/francis/orig/poco-1.3.6p2/lib/Darwin/i386/libPocoFoundation.9.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)
    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 625.0.0)

Which compiler or linker option determined this? How can I override this? (At compile time. I know that I can change it afterwards with the install_name_tool.)

Edit
The compiler is g++-4.0 (gcc version 4.0.1 Apple).

The linker is libtool (Apple Computer, Inc. version cctools-782)

I'm perusing the makefiles currently. Perhaps I'll figure it out myself. But all help is welcome!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

自我难过 2024-10-05 23:13:54

stackoverflow.com 上的相关问题 “如何在 Mac OSX 下使用 gcc 设置可执行文件的运行时路径 (-rpath)?” 解释了在编译时执行此操作的一些方法。

顺便说一句:我在 MacOS Leopard 上重现了您的 POCO 错误,并打开了 错误 3164792

Related question at stackoverflow.com "How to set the runtime path (-rpath) of an executable with gcc under Mac OSX?" explains some ways to do it at compile-time.

BTW: I've reproduced your POCO bug on MacOS Leopard and opened a bug 3164792 for POCO-1.4.0

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