libtool 与 ar 用于创建静态库(xcode 链接器)

发布于 2024-08-08 11:02:22 字数 437 浏览 2 评论 0原文

在 Mac 10.5 上使用 xcode 通过 libtool 创建静态库和通过命令行使用 ar 都会生成一个 libMainProject.a 文件,但是,当尝试使用 libtool 生成的文件链接到 xcode 应用程序时,我最终会收到多条消息,例如

“ project1 的 vtable 引用自: _ZTV27project1$non _lazy _ ptr in libMainProject.a(project1.o)"

使用 ar 完全没问题并且链接正确。我尝试在链接时向 libtool 添加 -c 选项,但似乎没有所以我想我的两个选择是

1) 找出导致 ar 和 libtool 版本之间符号差异的原因,并使 libtool 生成相同的信息

2) 让 xcode 使用 ar 而不是 libtool 来生成静态库。

任何想法或建议将不胜感激

Creating a static library on Mac 10.5 with xcode via libtool and with ar via the command line both generate a libMainProject.a file however, when trying to use the one generate by libtool to link into a xcode application I end up with multiple message like

"vtable for project1 referenced from:
_ZTV27project1$non _lazy _ ptr in libMainProject.a(project1.o)"

Using the ar one is totally fine and links correctly. I have tried the addition of the -c option to the libtool while linking but that does not seem to have an impact. So I guess my 2 options are

1) Figure out what is causing the differences in symbols between the ar and libtool version and make the libtool generate the same information.

2) Make xcode use ar instead of libtool to generate the static libs.

Any ideas or suggestions would be appreciated.

Thanks in advance.

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

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

发布评论

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

评论(1

淡笑忘祈一世凡恋 2024-08-15 11:02:22

我建议使用 ar 取消归档静态库。您最终将得到 *.o 文件。然后使用 gobjdump(您可能必须从 MacPorts/fink/homebrew 自行安装)来查看 *.o 文件中的内容并比较两个版本。

I suggest to unarchive the static library with ar. You will end up with the *.o files. Then use gobjdump (you might have to install that yourself from MacPorts/fink/homebrew) to see what's inside the *.o files and compare the two versions.

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