Xcode 4 Final - 与 armv6 库链接时出现“armv6 armv7”问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5316495/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 03:46:40  来源:igfitidea点击:

Xcode 4 Final - "armv6 armv7" issue while linking with armv6 libs

iphonexcodestatic-linkingarmv7armv6

提问by cusquinho

Until xcode 4 final (I was using 3.latest and 4 GM for the time it was available) this didn't happen. When I upgraded to xcode 4 final version, I started getting a linking error while trying to link the armv7 version with my non armv7 library (my project is set with the default Standard armv6 armv7 valid architectures):

直到 xcode 4 final(我在可用时使用 3.latest 和 4 GM)这才发生。当我升级到 xcode 4 最终版本时,我在尝试将 armv7 版本与我的非 armv7 库(我的项目设置为默认标准 armv6 armv7 有效架构)链接时开始出现链接错误:

ld: warning: ignoring file ../bin/iOS static/arm/libssl.a, file was built for archive which is not the architecture being linked (armv7)
ld: warning: ignoring file ../bin/iOS static/arm/libcrypto.a, file was built for archive which is not the architecture being linked (armv7)
Undefined symbols for architecture armv7: -- list of symbols --

The armv6 version compiles just fine, but the overall compilation process fails with 77 link errors.

armv6 版本编译得很好,但整个编译过程失败,出现 77 个链接错误。

I understand this is the expected behavior, it wont link towards armv7 with an armv6 lib. The fix is setting my project to armv6 only. My question here is: why was this working in the previous versions of xcode?

我知道这是预期的行为,它不会链接到带有 armv6 库的 armv7。修复是将我的项目设置为仅 armv6。我的问题是:为什么这在以前版本的 xcode 中有效?

If I set to armv6 only, I start to get this warning:

如果我只设置为 armv6,我开始收到此警告:

Check dependencies

[BWARN]warning: all apps should include an armv7 architecture (current ARCHS = "armv6").

I don't like seeing warnings :-) Anybody having similar issues?

我不喜欢看到警告 :-) 有人有类似的问题吗?

Thanks,

谢谢,

Fernando

费尔南多

回答by Rick

I just turned the Build active architecture only to Yes in the Project -> Build Setting -> Architectures tab.

我只是在 Project -> Build Setting -> Architectures 选项卡中将 Build active architecture 设置为 Yes。

回答by Pol

In iOS SDK 4.3, it looks like the linker will simply refuse to use a armv6 library in an armv7 binary - this wasn't the case before.

在 iOS SDK 4.3 中,链接器似乎只是拒绝在 armv7 二进制文件中使用 armv6 库 - 以前并非如此。

That's why I had to update the http://code.google.com/p/ios-static-libraries/project to generate both armv6 and armv7 versions of the libraries.

这就是为什么我必须更新http://code.google.com/p/ios-static-libraries/项目以生成库的 armv6 和 armv7 版本。

回答by Kiran S

I have added 3rd Party framework with some demo classes into project but once implemented it successfully I removed those demo classes and since then the error started coming up Error"ld: ........., file is universal but does not contain a(n) armv6 slice for architecture armv6"

我已经将带有一些演示类的 3rd Party 框架添加到项目中,但是一旦成功实施它,我删除了这些演示类,从那时起错误开始出现 错误“ld:……,文件是通用的,但没有包含架构 armv6 的 (n) armv6 切片"

After scratching my head for a whole day I found this solution next morning maybe helpful for fellow iphone buddies coz I know the pain

挠了一整天后,第二天早上我发现这个解决方案可能对 iphone 伙伴有帮助,因为我知道这种痛苦

Targets->"Your Project Target"-> Get Info ->Build Active Architecture only set to YES

Targets->"Your Project Target"-> Get Info -> Build Active Architecture 仅设置为 YES

Thats it..

就是这样..

回答by Zaraki

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 ;)

有同样的问题。但我想的原因是不同的。我正在使用为模拟器构建的 library.a 文件并尝试在设备上运行它.. 开始知道我需要不同的 .a 文件用于模拟器和设备。我希望这可以帮助别人 ;)

回答by cusquinho

Although I still don't know why this started happening only in the xcode 4 final version, I found that my external libs (ssl and crypto) were compiled against both armv6 and armv7 in the google code project very few days ago:

虽然我仍然不知道为什么只在 xcode 4 最终版本中开始发生这种情况,但我发现我的外部库(ssl 和 crypto)是几天前在谷歌代码项目中针对 armv6 和 armv7 编译的:

http://code.google.com/p/ios-static-libraries/

http://code.google.com/p/ios-static-libraries/

This will fix the issue if you define two different library search path: one for armv6, one for armv7.

如果您定义两个不同的库搜索路径,这将解决该问题:一个用于 armv6,一个用于 armv7。

Thanks,

谢谢,