Xcode4 链接问题。文件是为存档而构建的,不是正在链接的架构(arm6)
最近,我切换到 Xcode4,当我编译我的项目时,出现以下错误。
ld: warning: ignoring file /Users/myname/Library/Developer/Xcode/DerivedData/appname-hezrgyqimckztgbdlslkavphdclw/Build/Products/Debug-iphoneos/libTapkuLibrary.a, file was built for archive which is not the architecture being linked (armv6)
Undefined symbols for architecture armv6:
"_OBJC_CLASS_$_TKLoadingView", referenced from:
objc-class-ref in RootViewController.o
我打开 TapkuLibrary 并检查其架构是否设置为“标准(armv6 armv7)”。
我可以做什么来解决这个问题?
Recently, I switched to Xcode4 and when I compile my project I got following error.
ld: warning: ignoring file /Users/myname/Library/Developer/Xcode/DerivedData/appname-hezrgyqimckztgbdlslkavphdclw/Build/Products/Debug-iphoneos/libTapkuLibrary.a, file was built for archive which is not the architecture being linked (armv6)
Undefined symbols for architecture armv6:
"_OBJC_CLASS_$_TKLoadingView", referenced from:
objc-class-ref in RootViewController.o
I opened the TapkuLibrary and checked that it's Architectures set to 'Standard (armv6 armv7)'.
What can I do to fix this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(17)
我弄清楚是什么导致了这个问题。我将 TapkuLibrary 的“仅构建活动架构”从“是”更改为“否”,并且编译没有问题。
I figured out what caused the problem. I changed 'Build Active Architecture Only' of TapkuLibrary from Yes to No and it compiles with no problem.
我能够通过执行相反的操作来解决这个问题 接受的答案 - 我将“仅构建活动架构”从“否”更改为“是”。
I was able to solve this problem by doing the opposite of the accepted answer - I changed the 'Build Active Architecture Only' from NO to YES.
有同样的问题。但我想原因是不同的。我正在使用为模拟器构建的library.a 文件并尝试在设备上运行它..我发现我需要为模拟器和设备使用不同的.a 文件。我希望这对某人有帮助;)
Had the same problem. But the reason was different I suppose. I was using the library.a file built for simulator and trying to run it on device.. came to know that i need different .a files for simulator and device. I hope this helps someone ;)
我在将XCode升级到4.5并将iOS升级到iOS6时遇到了这个问题。对于 GMGridView 来说,它就这样发生了。
不适用于模拟器,仅适用于设备。
我通过以下步骤解决了这个问题:
1)进入GMGridView项目->构建设置
2) 在设置下-> Architectures,选择“Standard(armv7,armv7s)”
然后清理所有(包括DerivedData)并重建。
希望有帮助!
I met this problem when I upgraded the XCode to 4.5 and iOS to iOS6. For GMGridView, it just happened.
Not for simulator, but only for device.
I fixed this by the following steps:
1) Go to GMGridView project -> Build Settings
2) Under Setting -> Architectures, select "Standard (armv7, armv7s)"
Then clean all (including DerivedData) and rebuild.
Hope it helps!
尝试去掉armv6架构,只针对armv7编译。
Try to remove the armv6 architecture, and compile it only for armv7.
对我有用的其他事情是确保所有子项目的架构设置为armv6和armv7,确保设置每个子项目的目标和项目。清理并重建所有内容后,一切正常运行。
Something else that worked for me was making sure that all sub projects had the architecture set to be armv6 and armv7, making sure to set both the TARGET and the PROJECT of each sub project. After cleaning and rebuilding everything, it worked without a problem.
这解决了我的问题:
像 Three20 这样的外部库对
“构建设置”->“架构”->“任何 iOS SDK”进行了额外
设置,其值为“armv6 armv7”,与标准“armv7 armv7s”不同
,下拉列表并选择“标准” ,它对我有用。
This solved the problem for me:
Some external library like three20 did extra settings for
Build Settings->Architectures->Any iOS SDK
the value is "armv6 armv7" that different from standard "armv7 armv7s"
drop down and select "Standard", it worked for me.
我通过单击“不友好”项目(在我的例子中是 GMGridView)来管理它。
在“Architectures”选项卡中,我将值从“armv7,armv6s”更改为“armv7,armv7”(我不再记得了,我猜是:)。
之后它对我有用。
I managed it by clicking the "unfriendly" Project's (in my case GMGridView).
In tab "Architectures", I changed the value from something (I don't remember exactely anymore, I guess it was:) "armv7, armv6s" to "armv7, armv7".
After that it worked for me.
我设法通过在 Tapku 信息设置中创建临时配置来解决此问题...
XCODE 4,项目>存档 = 找不到 -lTapkuLibrary 的库 - 问题 - devinross/tapkulibrary - GitHub
I managed to resolve this by just creating a adhoc configuration inside the Tapku info settings ...
XCODE 4, Project > Archive = library not found for -lTapkuLibrary - Issues - devinross/tapkulibrary - GitHub
确保项目的构建变体设置为“正常”。
如果您正在构建一个包含其他项目的项目,请查看主项目的 DerivedData 文件夹。使用“lipo -info yourarchive.a”检查存档文件。另外,检查这些档案上的时间戳。您可能会发现这些库没有被重建,或者您正在尝试链接旧版本的存档,这是错误的架构。
就我而言,我关闭了 Xcode 并删除了主项目的 DerivedData 文件夹。当我在 Xcode 4 中重新打开主项目时,这会强制进行完全重建。完全重建导致创建 i386 档案(或找到正确的版本)和正确链接的模拟器版本。
Make sure the build variants on your projects are set to "normal".
If you are building a project which includes other projects, take a look inside the DerivedData folder for the main project. Examine the archive files with the "lipo -info yourarchive.a". Also, examine the timestamps on these archives. You may find that these libraries are not getting rebuilt or you are trying to link against an old version of the archive which is the wrong architecture.
In my case, I shutdown Xcode and deleted the DerivedData folder for my main project. This forced a full rebuild when I reopened the main project in Xcode 4. The full rebuild caused the i386 archives to be created (or the correct version to be found) & the simulator version to link correctly.
这对我有用:
单击有问题的框架的“项目”文件(xcodeproj)。
转到框架“项目”(不是“目标”)的“信息”选项卡。
展开“配置”并确保“调试”和“发布”都设置了 2 个配置 - 一个用于框架的“项目”,另一个用于框架的“目标”。对于框架,“目标”编译为库而不是应用程序,因此很容易混淆。
“调试”应将项目设置为“调试”并将库设置为“共享”
“发布”应将项目设置为“发布”,将库设置为“共享”
编译,运行,然后享受。
如果您最终为了解决这个问题而破坏了整个项目,那么您可能需要仔细检查应用程序的项目构建阶段(正如 Gon 建议的那样)。即使您的驱动器上不存在该库,也应该以红色突出显示。如果没有,只要将其设置为“共享”,您就应该能够再次将其添加回来。
如果你真的真的真的破坏了你的项目,那么你可能会被迫销毁你的 DerivedData 文件夹,正如 russes 所建议的那样。另外,请检查“组织器”,因为 Xcode 有一种方法可以在各处保存垃圾。
哦,您检查过以确保“armv6”存在,对吗? :)
This worked for me :
Click on the offending framework's 'Project' file (xcodeproj).
Go to the "Info" tab for the framework's 'Project' (not 'Target').
Expand 'Configurations' and make sure that both 'Debug' and 'Release' have 2 configurations set--one for the framework's 'Project' and another for the framework's 'Target'. In the case of frameworks the 'Target' compiles to a Library and not an application, so it's easy to get confused.
'Debug' should have the Project set to 'Debug' and the Library set to 'Shared'
'Release' should have the Project set to 'Release' and the Library set to 'Shared'
Compile, run, and enjoy.
If you ended up mangling your entire project trying to figure this out, then you might want to double-check your Application's Project build phases (as Gon suggested). The Library should be there highlighted in red, even if it doesn't exist on your drive. If not, as long as it's set to 'Shared' you should be able to add it back again.
If you really really really mangled your project, then you may be forced to blow out your DerivedData folder, as russes suggested. Also, check the 'Organizer', since Xcode has a way of saving crap all over the place.
Oh, and you checked to make sure that 'armv6' is there right? :)
如果我收到忽略文件警告 - 我会在被忽略的文件上运行 lipo -info 来查找它的架构,如下所示
这将打印 i386、armv6、armv7、armv7s、x86_64 等。一般来说,架构必须与您的目标构建平台相匹配。例如,
根据不匹配情况,您必须为目标平台重建库或更改目标平台。
注意:对于 fat 二进制文件,
lipo -info
将打印上述架构的组合。If I get the ignore file warning - I would run
lipo -info
on ignored file to find it's architecture as belowThat would print either of i386, armv6, armv7, armv7s, x86_64 etc. In general, that architecture has to match with your target build platform. E.g.
Depending on the mismatch, either you have to rebuild your library for your target platform or change your target platform.
Note: For fat binaries,
lipo -info
will print a combination of above architectures.我修复了这个问题,感谢另一个线程,他们显示armv6/armv7实际上与你想象的有点不同:升级到 xcode 4 错误 没有可编译的架构
I fixed this problem thanks to another thread where they show that armv6/armv7 is actually a little different than what you think it is: Upgrading to xcode 4 error No architectures to compile for
这些答案都不适合我。 (类似的警告消息,不同的静态库项目)。对我来说,是配置了 XCode 以遵循目标的构建目录,然后在本地
build/
目录中构建目标,从而导致了问题。配置 XCOde 使用“派生数据”文件夹修复了该问题。None of these answers worked for me. (Similar warning message, different static library project). For me it was having configured XCode to honor the build directories of the targets and then having targets build in a local
build/
directory that caused the problem. Configuring XCOde to use "Derived data" folder fixed it.我在使用 Three20 库时遇到了这个问题。最终为我完成的事情是将项目格式从 Xcode 3.1 切换到 Xcode 3.2 - 将“仅构建活动拱门”保留为“否”。
I had this problem with the Three20 library. The thing that finally did it for me was switching the Project Format from Xcode 3.1 to Xcode 3.2 - leaving 'build active arch only' as "no".
我尝试了上面所有的选项,但没有一个有效。
这是正确的答案:
仅在项目中拖动框架并不能正确链接它(或者在任何情况下都遵循这些思路)
您需要做的是选择要在“构建阶段”中添加的框架(单击项目的蓝色图标,然后在“目标”下选择项目名称,然后选择“构建阶段”选项卡),请参阅此处以获取更多参考。
I tried all the options above and none worked.
This is the right answer:
simply dragging a framework in your project won't link it properly (or something along these lines, in any case)
what you need to do is select the framework you want to add in Build Phases (click on your project's blue icon, then select your project's name under Targets, then the tab Build Phases), see here for more reference.
遇到同样的问题,尝试了页面上的各种解决方案,但无济于事。
我仍然收到一条消息,告诉我我的库不是为 arm64 构建的。
最后我是如何解决这个问题的:
XCode显示的构建设置不完整,并且与make文件不精确对应。
Had the same problem, and tried diverse solutions from the page to no avail.
I still had a message telling me my library was not build for arm64.
Finally how I resolved it :
Seems sometimes the build settings displayed by XCode is incomplete, and doesn't correspond precisely to the make file.