针对armv7时XCode链接错误
我已经花了无数个小时来思考这个问题,利用谷歌搜索和其他 Stack Overflow 问题都无济于事。
我有一个 iPhone/iPad 通用应用程序,当目标是 armv6 时,它似乎编译得很好。然而,当设备是 iPad 时,我收到此警告:
warning: building for SDK 'Device - iPhone OS 3.2' requires an armv7 architecture.
奇怪的是,尽管有此警告,该应用程序在 iPad 上仍然运行良好。然而,我确实想以“正确的方式”做事,无论在这种情况下意味着什么。当我将目标体系结构切换到armv7时,出现链接错误:
"___restore_vfp_d8_d15_regs", referenced from: *redacted* "___save_vfp_d8_d15_regs", referenced from: *redacted* ld: symbol(s) not found collect2: ld returned 1 exit status
错误的“编辑”部分是对我尝试链接的静态库的引用。
这是我从网上的许多建议中尝试过的。每一个都被不止一次地提出,没有任何解释,这让我相信没有人完全理解这个问题:
“切勿使用 XCode 窗口左上角的下拉菜单来选择目标。相反,请将其设置为 Base SDK,然后在目标配置中将 Base SDK 设置为 iPhone OS 3.0。将目标设备设置为您的设备首选目标(在我的情况下是 iPad、iPhone OS 3.2。)”
这会产生错误“未找到 -lcrt1.3.1.o 的库”
“确保 GCC 没有链接到错误版本的标准库。(您必须确保 LIBRARY_SEARCH_PATH 中没有错误的路径。)”
我的 LIBRARY_SEARCH_PATH 已经是空的,所以这不会'看起来相关。
“尝试使用 GCC 4.0 而不是 GCC 4.2 进行编译。”
我在 UIKit 头文件中遇到语法错误。错误是“‘AT_NAME’标记之前存在语法错误。”该行是“UIKIT_EXTERN @interface UILocalizedIndexedCollation:NSObject”。
另一个项目使用相同的目标设置编译得很好,这确实让我怀疑自己的理智。我可能正在处理一个损坏的 XCode 项目吗?
如果有人知道实际发生了什么并且有参考资料或者不介意解释它,我将非常感激。
干杯!
I've already spent countless hours puzzling over this, utilizing Google searches and other Stack Overflow questions to no avail.
I have an iPhone/iPad universal application, which seems to compile fine when the target is armv6. However, when the device is iPad, I get this warning:
warning: building for SDK 'Device - iPhone OS 3.2' requires an armv7 architecture.
Oddly enough, the app still runs great on iPad in spite of this warning. However, I do want to do things the "right way" what ever that means in this case. When I switch the target architecture to armv7, I get linking errors:
"___restore_vfp_d8_d15_regs", referenced from: *redacted* "___save_vfp_d8_d15_regs", referenced from: *redacted* ld: symbol(s) not found collect2: ld returned 1 exit status
The "redacted" portions of the errors are references to the static library to which I'm trying to link.
Here's what I've tried from the many suggestions online. Each of these were suggested more than once without any explanation, which leads me to believe nobody quite understands this problem:
"Never use the drop down menu in the upper left of the XCode window to choose the target. Instead, set this to Base SDK and then the Base SDK to iPhone OS 3.0 in the target configuration. Set the target device to your preferred target (iPad, iPhone OS 3.2 in my situation.)"
This yields the error "Library not found for -lcrt1.3.1.o"
"Make sure that GCC isn't linking against the wrong version of the standard library. (You'll have to make sure the LIBRARY_SEARCH_PATH doesn't have the wrong path in it.)"
My LIBRARY_SEARCH_PATH is already empty, so this doesn't seem relevant.
"Try compiling with GCC 4.0 rather than GCC 4.2."
I get a syntax error inside a UIKit header file. The error is "Syntax error before 'AT_NAME' token." The line is "UIKIT_EXTERN @interface UILocalizedIndexedCollation : NSObject."
Another project compiles just fine with the same target settings, which is really making me question my sanity. Could I be dealing with a corrupt XCode project?
If anyone knows what's actually happening and has a reference or doesn't mind explaining it, I would be so very grateful.
Cheers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
ARMv7 和 ARMv6 之间的 VFP 在很多方面都有所不同。在 ARMv7 中,通常最好使用 NEON。问题是您的静态库依赖于 ARMv6 中的 VFP - 您要么需要在 ARMv7 上编译该库,要么将整个应用程序保留在 ARMv6 上。
恢复到 GCC 4.0 是愚蠢的 - 那时 ARMv7 支持基本上不存在,除非 Apple 向后移植它。
VFP between ARMv7 and ARMv6 differs in various ways. In ARMv7 its usually preferable to use NEON. The problem is your static library depends on VFP in ARMv6 - you either need to compile the library at ARMv7 or keep the whole application at ARMv6.
Reverting back to GCC 4.0 is silly - ARMv7 support was basically nonexistent back then unless Apple backported it.
除了armv6 之外,我也遇到了同样的错误。我通过在静态库和主项目的项目设置中取消选中“Compile for Thumb”来修复它们。
I had the same errors except it was for armv6. I fixed them by unchecking "Compile for Thumb" in the project settings for the static library and the main project.
尝试这样做 http://groups.google.com/group/third20 /browse_thread/thread/31ddbc047aa1b9ae/c4c5827ab0c7a76f
try do like this http://groups.google.com/group/three20/browse_thread/thread/31ddbc047aa1b9ae/c4c5827ab0c7a76f
就 AT_NAME 错误而言,其中一种可能性是
检查您是否错过了课程中的@end。
要了解有关 AT_NAME 错误的更多信息,请访问以下链接
http://iosdevelopertips .com/xcode/error-syntax-error-before-at_name-token.html
As far as AT_NAME error is concerned one of the possiblity is
Check if you miss the @end in a class.
To know more about AT_NAME error visit the following link
http://iosdevelopertips.com/xcode/error-syntax-error-before-at_name-token.html