Apple Mach-O链接器错误

时间:2013-03-25 20:45:00

标签: ios linker mach-o

我曾尝试将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的?为什么呢?

相信我这个,我完成了我的家庭作业,我用谷歌搜索并尝试构建设置中的每一个选项都可能是错误的......没有成功。 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 / 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 -filelist /Users/jan/Library/Developer/Xcode/DerivedData/vivasjofart-dvimgeakkxnlwqceslyrhdyifmtf/Build/Intermediates/vivasjofart.build/Debug-iphonesimulator/Da visTest.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 / DavisTest

     

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

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

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

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

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

感谢大家的时间!

亲切的问候, Jan Gifvars