Apple Mach-O链接器错误

问题描述 投票:1回答:2

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

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

相信我这个,我完成了我的作业,我用Google搜索并尝试构建设置中的每个选项都可能是错误的......没有成功。 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/ Developer / SDKs / iPhoneSimulator6.1.sdk -L / Users / jan / Library / Developer / Xcode / DerivedData / vivasjofart -dvimgeakkxnlwqceslyrhdyifmtf / Build / Products / Debug-iphonesimulator -L / Users / jan / utveckling / vivasjofart / vivasjofart -L /用户/ jan / utveckling / vivasjofart / vivasjofart /../../ coreplot-examples / DatePlot -L / Developer / Platforms / iPhoneOS.platform / DeviceSupport / 4.2 / Sy mbols / usr / lib -L ​​/ Developer / Platforms / iPhoneOS.platform / Developer / SDKs / iPhoneOS4.3.sdk / usr / lib -F / Users / jan / Library / Developer / Xcode / DerivedData / vivasjofart-dvimgeakkxnlwqceslyrhdyifmtf / Build /产品/ Debug-iphonesimulator -F / Applications / Xcode.app / Contents / Developer / Library / Frameworks -filelist /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 /编译/产品/调试-iphonesimulator / DavisTest.octest / DavisT美东时间

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,缺少必需架构i386在文件/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2/Symbols/usr/lib/libobjc.dylib(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:in'/ Developer / Platforms / iPhoneOS.platform / DeviceSupport / 4.2 / Symbols / usr / lib / libobjc.A.dylib',文件中缺少必需的体系结构i386 /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2/Symbols/usr/lib/libobjc.Ad对于体系结构i386 clang的ylib(2个切片):错误:链接器命令失败,退出代码为1(使用-v查看调用)

ios linker mach-o
2个回答
0
投票

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


0
投票

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

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

如果您需要更多详细信息,请登录apple.developer并搜索“测试用例给Apple Mach-O链接器错误”

谢谢大家的时间!

亲切的问候,Jan Gifvars

© www.soinside.com 2019 - 2024. All rights reserved.