xcode 在构建应用程序目标的文件 XCTest 中缺少所需的架构 armv7

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20546914/
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-15 04:25:24  来源:igfitidea点击:

missing required architecture armv7 in file XCTest on building application target

iosobjective-cxcode

提问by Ethan Allen

To start, i looked at all the other search topics and none applied or didn't work. For example, i have a hard time that apple didn't make xctest compatible with all architectures.

首先,我查看了所有其他搜索主题,但没有应用或不起作用。例如,我很难发现苹果没有让 xctest 与所有架构兼容。

On a Xcode project for work i randomly started getting the following build error on linking:

在用于工作的 Xcode 项目中,我随机开始在链接时收到以下构建错误:

Ld /Users/eallen/Library/Developer/Xcode/DerivedData/InVenueExperience-fgszkxctprmkuvbvwzgprcuveheo/Build/Intermediates/InVenueExperience.build/Debug-iphoneos/InVenueExperience.build/Objects-normal/armv7/InVenueExperience normal armv7
cd /Users/eallen/tmdev/ios/mive
setenv IPHONEOS_DEPLOYMENT_TARGET 7.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -L/Users/eallen/Library/Developer/Xcode/DerivedData/InVenueExperience-fgszkxctprmkuvbvwzgprcuveheo/Build/Products/Debug-iphoneos -L/Users/eallen/tmdev/ios/mive -L/Users/eallen/Library/Developer/Xcode/DerivedData/InVenueExperience-fgszkxctprmkuvbvwzgprcuveheo/Build/Intermediates -F/Users/eallen/Library/Developer/Xcode/DerivedData/InVenueExperience-fgszkxctprmkuvbvwzgprcuveheo/Build/Products/Debug-iphoneos -FFrameworks -FPods/Pixate/Framework/iOS -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/Developer/Library/Frameworks -filelist /Users/eallen/Library/Developer/Xcode/DerivedData/InVenueExperience-fgszkxctprmkuvbvwzgprcuveheo/Build/Intermediates/InVenueExperience.build/Debug-iphoneos/InVenueExperience.build/Objects-normal/armv7/InVenueExperience.LinkFileList -dead_strip -ObjC -lObjC -lxml2 -framework CoreGraphics -framework CoreText -framework MobileCoreServices -framework Pixate -framework QuartzCore -framework Security -framework SystemConfiguration -framework UIKit -fobjc-arc -fobjc-link-runtime -fprofile-arcs -ftest-coverage -miphoneos-version-min=7.0 -lPods -framework QuartzCore -framework CoreText -framework CoreGraphics -framework CoreData -framework UIKit -framework Foundation -framework Crashlytics -Xlinker -dependency_info -Xlinker /Users/eallen/Library/Developer/Xcode/DerivedData/InVenueExperience-fgszkxctprmkuvbvwzgprcuveheo/Build/Intermediates/InVenueExperience.build/Debug-iphoneos/InVenueExperience.build/Objects-normal/armv7/InVenueExperience_dependency_info.dat -o /Users/eallen/Library/Developer/Xcode/DerivedData/InVenueExperience-fgszkxctprmkuvbvwzgprcuveheo/Build/Intermediates/InVenueExperience.build/Debug-iphoneos/InVenueExperience.build/Objects-normal/armv7/InVenueExperience

ld: in '/Applications/Xcode.app/Contents/Developer/Library/Frameworks/XCTest.framework/XCTest', missing required architecture armv7 in file /Applications/Xcode.app/Contents/Developer/Library/Frameworks/XCTest.framework/XCTest (2 slices) for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

All this while trying to build my application target and NOT my test target. Some further notes:

所有这些都是在尝试构建我的应用程序目标而不是我的测试目标时。一些进一步的说明:

  • I am NOT linking against XCTest in my build settings for the application target
  • I am building, not testing this specific target
  • I do have in both my build settings -> Architectures|Valid Architectures "Standard Architectures (armv7, armv7s).
  • This only happens when i build for a iOS device and not a simulator...i think this is because building for a simulator only tries the i386 architecture?
  • 我没有在应用程序目标的构建设置中链接 XCTest
  • 我正在构建,而不是测试这个特定目标
  • 我的构建设置 -> 架构|有效架构中都有“标准架构(armv7、armv7s)”。
  • 这只发生在我为 iOS 设备而不是模拟器构建时......我认为这是因为为模拟器构建只尝试 i386 架构?

To be honest, i have no idea why the linker is even trying to link against XCTest in this case...i even modified the scheme to remove all tests though i wasn't trying to test against the target.

老实说,我不知道为什么在这种情况下链接器甚至试图链接 XCTest……我什至修改了方案以删除所有测试,尽管我没有尝试针对目标进行测试。

Please feel free to ask me any other questions.

请随时问我任何其他问题。

回答by emp

You may have the same simple but frustrating problem as I had. It's a scheme setting: Click on your project scheme in the toolbar (right of the play/stop buttons), and select 'Edit' from the popup. Under the 'Build' item on the left, make sure your test targets only have 'Test' checked.

你可能有和我一样简单但令人沮丧的问题。这是一个方案设置:单击工具栏中(播放/停止按钮右侧)的项目方案,然后从弹出窗口中选择“编辑”。在左侧的“构建”项下,确保您的测试目标只选中了“测试”。

回答by marter0574

Please make sure the Build Setting of "build Active Architecture only" is set to NO, maybe it's the cause of this problem.

请确保“仅构建活动架构”的构建设置设置为否,这可能是导致此问题的原因。

回答by Ethan Allen

Turns out that buried deep in the compile sources for the application target i had a file that included imports for XCTest stuff...removing this immediately made this go away.

事实证明,深埋在应用程序目标的编译源中,我有一个文件,其中包含 XCTest 内容的导入……立即删除它使之消失。

So answer being verify that you do not have anything in your compile sources list that may reference a library you didn't intend

因此,请确认您的编译源列表中没有任何可能引用您不想要的库的内容

回答by Oliver Mason

I just had the same issue after including a third-party project. When selecting the target I chose the main project target (not the test target), but the included project had a sub-target which were unit tests. Xcode helpfully added those to my main application target. After changing the target setting for the relevant file it worked alright.

在包含第三方项目后,我刚刚遇到了同样的问题。选择目标时,我选择了主项目目标(不是测试目标),但包含的项目有一个子目标,即单元测试。Xcode 帮助将这些添加到我的主要应用程序目标中。更改相关文件的目标设置后,它工作正常。

回答by vedrano

It happens that after adding $(PLATFORM_DIR)/Developer/Library/Frameworksas a first item in <Target>/<Build Settings>/<Search Paths>/<Framework Search Paths>I got rid of nasty "ld: framework not found XCTest for architecture arm64" link error by using XCode 6.3.1.

碰巧在添加$(PLATFORM_DIR)/Developer/Library/Frameworks为第一项之后,<Target>/<Build Settings>/<Search Paths>/<Framework Search Paths>我通过使用 XCode 6.3.1 摆脱了令人讨厌的“ld: framework not found XCTest for architecture arm64”链接错误。