1

我试图在我的项目中添加一个 testunit 目标,但失败了。我的 testunit 需要 libxml2.dylib(实际上是 libxml2.2.dylib),当然还有 sentestingunit.framework。我将 libxml2.dylib 添加到构建设置中的 FRAMEWORK_SEARCH_PATHS $(inherited) "$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Developer/Library/Frameworks"

然后我在构建阶段添加 sentestingunit.framework -> 将二进制文件与库链接。我有我的应用程序(称为 vindfyrar)作为目标依赖项。现在我的测试目标的构建开始尖叫下面的所有东西;有人知道我做错了什么吗?i386? 为什么?

相信我,我已经完成了我的功课,即用谷歌搜索并尝试了构建设置中可能出错的每个选项......没有成功。Lion 10.7.5 上的 XCode 4.6

亲切的问候, Jan Gifvars

ld /Users/jan/Library/Developer/Xcode/DerivedData/vivasjofart-dvimgeakkxnlwqceslyrhdyifmtf/Build/Products/Debug-iphonesimulator/DavisTest.octest/DavisTest normal i386 cd /Users/jan/utveckling/vivasjofart/vivasjofart setenv IPHONEOS_DEPLOYMENT_TARGET 6.1 setenv PATH " /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.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 i386 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/开发者/SDKs/iPhoneSimulator6.1。sdk -L/Users/jan/Library/Developer/Xcode/DerivedData/vivasjofart-dvimgeakkxnlwqceslyrhdyifmtf/Build/Products/Debug-iphonesimulator -L/Users/jan/utveckling/vivasjofart/vivasjofart -L/Users/jan/utveckling/vivasjofart/ vivasjofart/../../coreplot-examples/DatePlot -L/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2/Symbols/usr/lib -L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4。 3.sdk/usr/lib -F/Users/jan/Library/Developer/Xcode/DerivedData/vivasjofart-dvimgeakkxnlwqceslyrhdyifmtf/Build/Products/Debug-iphonesimulator -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -文件列表/Users/jan/Library/Developer/Xcode/DerivedData/vivasjofart-dvimgeakkxnlwqceslyrhdyifmtf/Build/Intermediates/vivasjofart.build/Debug-iphonesimulator/DavisTest.build/Objects-normal/i386/DavisTest。LinkFileList -bundle_loader /Users/jan/Library/Developer/Xcode/DerivedData/vivasjofart-dvimgeakkxnlwqceslyrhdyifmtf/Build/Products/Debug-iphonesimulator/vindfyrar.app/vindfyrar -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.1 -framework SenTestingKit -framework UIKit -framework Foundation -o /Users/jan/Library/Developer/Xcode/DerivedData/vivasjofart-dvimgeakkxnlwqceslyrhdyifmtf/Build/Products/Debug-iphonesimulator/DavisTest.octest/戴维斯测试1 -framework SenTestingKit -framework UIKit -framework Foundation -o /Users/jan/Library/Developer/Xcode/DerivedData/vivasjofart-dvimgeakkxnlwqceslyrhdyifmtf/Build/Products/Debug-iphonesimulator/DavisTest.octest/DavisTest1 -framework SenTestingKit -framework UIKit -framework Foundation -o /Users/jan/Library/Developer/Xcode/DerivedData/vivasjofart-dvimgeakkxnlwqceslyrhdyifmtf/Build/Products/Debug-iphonesimulator/DavisTest.octest/DavisTest

ld:警告:忽略文件/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/bundle1.o,文件/Developer/Platforms/iPhoneOS.platform/Developer/中缺少所需的架构i386 SDKs/iPhoneOS4.3.sdk/usr/lib/bundle1.o(2片)ld:警告:忽略文件/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2/Symbols/usr/lib/libobjc.dylib,缺少必需的文件 /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2/Symbols/usr/lib/libobjc.dylib 中的架构 i386(2 片)ld:警告:忽略文件 /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2/Symbols /usr/lib/libSystem.dylib,在文件 /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2/Symbols/usr/lib/libSystem.dylib(2 片)中缺少所需的体系结构 i386 ld:在'/Developer/Platforms/ iPhoneOS.platform/DeviceSupport/4。2/Symbols/usr/lib/libobjc.A.dylib',在文件 /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2/Symbols/usr/lib/libobjc.A.dylib(2 片)中缺少所需的架构 i386架构 i386 clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

4

2 回答 2

0

我通过添加这些设置和值解决了这个问题。

对于测试主机,它是 $(BUNDLE_LOADER) 对于 Bundle Loader,它是 $(BUILT_PRODUCTS_DIR)/ApplicationName.app/ApplicationProductName

如果您想了解更多详细信息,请登录 apple.developer 并搜索“Test case give Apple Mach-O Linker Error”

感谢大家的时间!

亲切的问候, Jan Gifvars

于 2013-04-07T19:40:17.893 回答
0

您正在链接 iPhoneOS SDK(其中所有二进制文件都是为架构臂构建的),但您正在构建一个 iPhone 模拟器程序 (i386)。您的项目链接到错误的 SDK。

于 2013-03-26T09:51:37.460 回答