创建 StaticLib 时格式错误的存档 TOC 条目
我目前正在开发一个项目,该项目创建一个静态库和三个链接到该库的可执行文件。在干净的构建中,当我尝试在 OSX 10.7.1 上创建库时,它将正确构建。但是,如果它不是一个干净的构建,那么我会收到此错误。
ld: in ./libframework.a, malformed archive TOC entry for GameApp::~GameApp(), offset 222233108 is beyond end of file 3056 for architecture x86_64
如果我在收到此错误后进行干净的构建,则无需更改任何构建设置,它将顺利编译。链接错误似乎并不总是适用于同一条目。如果我注释掉析构函数,那么它只会引用另一个条目。
有什么想法吗?
I'm currently working on a project which creates a static library and three executables that link to this library. On a clean build when I try to create the library on OSX 10.7.1 it will build correctly. However if it's not a clean build then I get this error.
ld: in ./libframework.a, malformed archive TOC entry for GameApp::~GameApp(), offset 222233108 is beyond end of file 3056 for architecture x86_64
Without changing any build settings if I do a clean build after receiving this error then it will compile without issues. The linking error doesn't seem to always apply to the same entry. If I comment out the desctructor then it will just refer to another entry.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这里的错误是重新编译时需要更新静态库的目录。要解决此问题,可以将 -s 标志添加到 ar 中,或者可以在编译库之后但链接之前执行 ranlib。
The error here is that the table of contents of the static library need to be updated when recompiling. To fix this the -s flag can be added to ar or ranlib can be executed after compiling the library but before linking.
我通过删除文件(/Users/ios5/Library/Developer/Xcode/DerivedData//Build/Products/Debug-iphonesimulator/.a)解决了该问题
I've fixed the issue by deleting the file (/Users/ios5/Library/Developer/Xcode/DerivedData//Build/Products/Debug-iphonesimulator/.a)