libtool vs ar for creating a static library (xcode linker)

假装没事ソ 提交于 2019-12-12 15:27:56

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/1591384/libtool-vs-ar-for-creating-a-static-library-xcode-linker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!