O Linker Error

I have tried to add a testunit target to my project but failed enourmously. My testunit requires libxml2.dylib (actually libxml2.2.dylib) and of course sentestingunit.framework. I add the libxml2.dylib to the FRAMEWORK_SEARCH_PATHS in build settings $(inherited) "$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Developer/Library/Frameworks"

Then I add the sentestingunit.framework in the build phase -> link binary with libraries. I have my app (called vindfyrar) as a target dependencies. Now the the build of my testing target start to scream all the stuff below; Any one got an idea what I have done wrong? i386? Why?

Beleive me on this one, I have done my homework, ie googled and try every option in the build settings that could possible be wrong... No success. XCode 4.6 on Lion 10.7.5

Kind regards, 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/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/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/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/DavisT est

ld: warning: ignoring file /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/bundle1.o, missing required architecture i386 in file /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/bundle1.o (2 slices) ld: warning: ignoring file /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2/Symbols/usr/lib/libobjc.dylib, missing required architecture i386 in file /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2/Symbols/usr/lib/libobjc.dylib (2 slices) ld: warning: ignoring file /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2/Symbols/usr/lib/libSystem.dylib, missing required architecture i386 in file /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2/Symbols/usr/lib/libSystem.dylib (2 slices) ld: in '/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2/Symbols/usr/lib/libobjc.A.dylib', missing required architecture i386 in file /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2/Symbols/usr/lib/libobjc.A.d ylib (2 slices) for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)


You're linking against the iPhoneOS SDKs (where all the binaries are built for architecture arm) but you're building an iPhone Simulator program (i386). Your project is linking against the wrong SDK.


I have solved the problem by adding these setting and values.

For Test Host it's $(BUNDLE_LOADER) For Bundle Loader it's $(BUILT_PRODUCTS_DIR)/ApplicationName.app/ApplicationProductName

If you want more details log in to apple.developer and search for "Test case give Apple Mach-O Linker Error"

Thanks everyone for your time!

Kind regards, Jan Gifvars

链接地址: http://www.djcxy.com/p/52456.html

上一篇: 在IOS6.1中构建FFMpeg错误无法创建可执行文件

下一篇: O链接器错误