libtool vs ar用于创建静态库(xcode链接器) [英] libtool vs ar for creating a static library (xcode linker)

查看:249
本文介绍了libtool vs ar用于创建静态库(xcode链接器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

针对project1的vtable,引用自: _ZTV27project1 $ non _lazy _ ptr在libMainProject.a(project1.o)中

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

使用ar完全可以正常连接.我尝试在链接时将-c选项添加到libtool中,但这似乎没有影响.所以我想我的2个选项是

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)找出导致ar和libtool版本之间的符号差异的原因,并使libtool生成相同的信息.

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)使xcode使用ar代替libtool生成静态库.

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

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

Any ideas or suggestions would be appreciated.

先谢谢了.

推荐答案

我建议使用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.

这篇关于libtool vs ar用于创建静态库(xcode链接器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆