Apple Mach-O Linker Error - ios

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, i e 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/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/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/DavisTest
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.dylib (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

Related

clang: error: linker command failed with exit code 1 iOS9

I am getting the following error while running the code.I have recently updated my xcode to xcode 7.
Ld /Users/anurajennai/Library/Developer/Xcode/DerivedData/cdm_player_ios-cvwkkaawlnzyccamzriqmgoezgqi/Build/Products/Debug-iphoneos/cdm_reference_player.app/cdm_reference_player normal armv7
cd /Users/anurajennai/Desktop/myApps/unziped/cdm_player_xcode_template
export IPHONEOS_DEPLOYMENT_TARGET=7.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/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/iPhoneOS9.0.sdk -L/Users/anurajennai/Library/Developer/Xcode/DerivedData/cdm_player_ios-cvwkkaawlnzyccamzriqmgoezgqi/Build/Products/Debug-iphoneos -L/Users/anurajennai/Library/Developer/Xcode/DerivedData/cdm_player_ios-cvwkkaawlnzyccamzriqmgoezgqi/Build/Products/Debug -L/Users/anurajennai/Desktop/myApps/unziped/cdm_player_xcode_template/oemcrypto_tfit_ios/dev -F/Users/anurajennai/Library/Developer/Xcode/DerivedData/cdm_player_ios-cvwkkaawlnzyccamzriqmgoezgqi/Build/Products/Debug-iphoneos -F/Users/anurajennai/Desktop/myApps/unziped/cdm_player_xcode_template/oemcrypto_tfit_ios/dev -F/Users/anurajennai/Desktop/myApps/unziped/cdm_player_xcode_template/oemcrypto_tfit_ios_dylib/dev -F/Users/anurajennai/Desktop/myApps/unziped/cdm_player_xcode_template/oemcrypto_tfit_ios_dylib/release -filelist /Users/anurajennai/Library/Developer/Xcode/DerivedData/cdm_player_ios-cvwkkaawlnzyccamzriqmgoezgqi/Build/Intermediates/cdm_player_ios.build/Debug-iphoneos/cdm_reference_player.build/Objects-normal/armv7/cdm_reference_player.LinkFileList -Xlinker -rpath -Xlinker #executable_path/Frameworks -miphoneos-version-min=7.0 -fembed-bitcode-marker -fobjc-arc -fobjc-link-runtime -framework oemcrypto_tfit2-eit_release_dylib /Users/anurajennai/Library/Developer/Xcode/DerivedData/cdm_player_ios-cvwkkaawlnzyccamzriqmgoezgqi/Build/Products/Debug-iphoneos/libCocoaAsyncSocket.a /Users/anurajennai/Library/Developer/Xcode/DerivedData/cdm_player_ios-cvwkkaawlnzyccamzriqmgoezgqi/Build/Products/Debug-iphoneos/libCocoaHTTPServer.a /Users/anurajennai/Library/Developer/Xcode/DerivedData/cdm_player_ios-cvwkkaawlnzyccamzriqmgoezgqi/Build/Products/Debug-iphoneos/libTBXML-iOS.a -framework AVFoundation -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreMedia -framework Foundation -framework Security -framework UIKit -framework oemcrypto_tfit2-eit_dev_dylib -framework oemcrypto_tfit2_dev_dylib_sim -Xlinker -dependency_info -Xlinker /Users/anurajennai/Library/Developer/Xcode/DerivedData/cdm_player_ios-cvwkkaawlnzyccamzriqmgoezgqi/Build/Intermediates/cdm_player_ios.build/Debug-iphoneos/cdm_reference_player.build/Objects-normal/armv7/cdm_reference_player_dependency_info.dat -o /Users/anurajennai/Library/Developer/Xcode/DerivedData/cdm_player_ios-cvwkkaawlnzyccamzriqmgoezgqi/Build/Products/Debug-iphoneos/cdm_reference_player.app/cdm_reference_player
ld: '/Users/anurajennai/Desktop/myApps/unziped/cdm_player_xcode_template/oemcrypto_tfit_ios_dylib/release/oemcrypto_tfit2-eit_release_dylib.framework/oemcrypto_tfit2-eit_release_dylib' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
EDIT
see this image.In the error log,it says
oemcrypto_tfit2-eit_release_dylib' does not contain bitcode
do which one do I have to set "NO" and which one to "YES"?
after changing BITCODE setting(if both debug and release are NO,the same error is coming)
ld: warning: ignoring file /Users/anurajennai/Desktop/myApps/unziped/cdm_player_xcode_template/oemcrypto_tfit_ios_dylib/release/oemcrypto_tfit2-eit_release_dylib.framework/oemcrypto_tfit2-eit_release_dylib, missing required architecture i386 in file /Users/anurajennai/Desktop/myApps/unziped/cdm_player_xcode_template/oemcrypto_tfit_ios_dylib/release/oemcrypto_tfit2-eit_release_dylib.framework/oemcrypto_tfit2-eit_release_dylib (2 slices)
ld: warning: ignoring file /Users/anurajennai/Desktop/myApps/unziped/cdm_player_xcode_template/oemcrypto_tfit_ios/dev/oemcrypto_tfit2-eit_dev_dylib.framework/oemcrypto_tfit2-eit_dev_dylib, missing required architecture i386 in file /Users/anurajennai/Desktop/myApps/unziped/cdm_player_xcode_template/oemcrypto_tfit_ios/dev/oemcrypto_tfit2-eit_dev_dylib.framework/oemcrypto_tfit2-eit_dev_dylib (2 slices)
ld: embedded dylibs/frameworks are only supported on iOS 8.0 and later (#rpath/oemcrypto_tfit2_dev_dylib_sim.framework/oemcrypto_tfit2_dev_dylib_sim) for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
oemcrypto_tfit2-eit_release_dylib.framework/oemcrypto_tfit2-eit_release_dylib
Doesn't contain bitcode, either ask the vendor of this library to provide bit code or disable bitcode for this project
Please read the error message again:
'oemcrypto_tfit2-eit_release_dylib.framework/oemcrypto_tfit2-eit_release_dylib' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture armv7
As far as I can see you have already solved problem with Bitcode, so my answer only about last error messages:
ld: warning: ignoring file /Users/anurajennai/Desktop/myApps/unziped/cdm_player_xcode_template/oemcrypto_tfit_ios_dylib/release/oemcrypto_tfit2-eit_release_dylib.framework/oemcrypto_tfit2-eit_release_dylib, missing required architecture i386 in file
means that lib doesn't have i386 arch (can't be used on simulator) try build for iOS device
second one:
ld: embedded dylibs/frameworks are only supported on iOS 8.0 and later
but I see that in your project:
export IPHONEOS_DEPLOYMENT_TARGET=7.0
deployment target set to 7.0 so you should decide something with it

What is causing this Crashlytics compile warning? (Auto-Linking supplied '...' framework linker option at '...' is not a dylib)

Compiling my main target (not a test target like here) yields this error:
ld: warning: Auto-Linking supplied
'~/Documents/my_app/MyApp/Crashlytics.framework/Crashlytics',
framework linker option at
~/Documents/my_app/MyApp/Crashlytics.framework/Crashlytics
is not a dylib
From this build command:
Ld /Build/Products/Debug-iphonesimulator/MyApp.app/MyApp normal i386
cd ~/Documents/my_app/MyApp
export IPHONEOS_DEPLOYMENT_TARGET=8.0
export 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 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.2.sdk -L~/Library/Developer/Xcode/DerivedData/MyApp-dbmrsjmskpqxmnegayfzfxgcwvsm/Build/Products/Debug-iphonesimulator -F~/Library/Developer/Xcode/DerivedData/MyApp-dbmrsjmskpqxmnegayfzfxgcwvsm/Build/Products/Debug-iphonesimulator -F~/Documents/my_app/MyApp -filelist ~/Library/Developer/Xcode/DerivedData/MyApp-dbmrsjmskpqxmnegayfzfxgcwvsm/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/MyApp.LinkFileList -Xlinker -rpath -Xlinker #executable_path/Frameworks -Xlinker -objc_abi_version -Xlinker 2 -ObjC -lPods-CocoaLumberjack -lPods-Mantle -framework CFNetwork -framework Foundation -framework Security -framework SystemConfiguration -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=8.0 -framework CoreGraphics -lPods -framework MapKit -framework Fabric -lPods-MyApp -Xlinker -dependency_info -Xlinker ~/Library/Developer/Xcode/DerivedData/MyApp-dbmrsjmskpqxmnegayfzfxgcwvsm/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/MyApp_dependency_info.dat -o ~/Library/Developer/Xcode/DerivedData/MyApp-dbmrsjmskpqxmnegayfzfxgcwvsm/Build/Products/Debug-iphonesimulator/MyApp.app/MyApp
The Missing Link:
This error is almost always produced by not having the binary linked to the library (In this case it would be the Crashlytics.framework):
Trying to build the target MyApp (which includes headers with #import <Crashlytics/Crashlytics.h> will produce the error:
ld: warning: Auto-Linking supplied
'../../Crashlytics.framework/Crashlytics', framework linker option at
../../Crashlytics.framework/Crashlytics is not a dylib
Link the Framework:
Fortunately, it should be easy to fix the problem simply by dragging the Crashlytics.framework from the Frameworks folder in the project navigator into the list of Link Binary With Libraries or by using the +.
Make sure you have your App selected/highlighted under Targets while doing this process.
I had the same issue but my reason was different.
Error Output
ld: warning: Auto-Linking supplied '~/GameFolder/Pods/Fabric/tvOS/Fabric.framework/Fabric', framework linker option at ~/GameFolder/Pods/Fabric/tvOS/Fabric.framework/Fabric is not a dylib
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_Answers", referenced from:
type metadata accessor for __ObjC.Answers in GameScene.o
type metadata accessor for __ObjC.Answers in AppDelegate.o
"_OBJC_CLASS_$_Crashlytics", referenced from:
type metadata accessor for __ObjC.Crashlytics in AppDelegate.o
"_OBJC_CLASS_$_Fabric", referenced from:
type metadata accessor for __ObjC.Fabric in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Reason
My target was overriding the OTHER_LDFLAGS.
Solution
Changed the OTHER_LDFLAGS to just inherit the Linker Flags. Basically, changed it to $(inherited)
I followed all steps provided by #i'L'i but I was not able to find Crashlytics.framework and Fabric.framework file in build phases.
So this helped me.
Step 1: Follow all the steps given Here.
Step 2: Now when you are unable to find Crashlytics.framework and Fabric.framework files in Link Binary With Libraries by clicking + do following.
2.1: Click on + button in Link Binary With Libraries.
2.2: Click on Add Other... button.
2.3: Now chose Crashlytic.framework and Fabric.framework from Pod folder - if using cocoapods, else choose both file from where you have downloaded it.
Step 3: Build Succeeded, Enjoy. :)
For future reference, this can also happen if you link your test files to your app target.
For example:
https://github.com/realm/realm-cocoa/issues/1661
I had the same problem. Maybe I messed up the initial fabric install but once I added Fabric.framework to the list of frameworks (should be in the root folder of your app by default) everything worked.
Conversely to what I'L'I and user3517250 mention, the problem might also be that you have #import statements that shouldn't be there.
Xcode does infer the frameworks to link against from the #import statements. If you import a framework that you don't link against, then you get this warning.

How to solve Mach-O-Linker error in ios7 & Xcode 5.0.1

I cannot compile my project for the simulator .
I get Apple Mach-O-Linker error.I cant understand how to solve the issues.I am using xcode 5.0.1.
Please help me any body.
Thanks in advance.
Ld /Users/murthych/Library/Developer/Xcode/DerivedData/ClassifiedDetails-elseirogpshyhmffphsiejgydphd/Build/Products/Debug-iphonesimulator/ClassifiedDetails.app/ClassifiedDetails normal i386
cd /Users/murthych/Desktop/ClassifiedDetails
setenv IPHONEOS_DEPLOYMENT_TARGET 7.0
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 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -L/Users/murthych/Library/Developer/Xcode/DerivedData/ClassifiedDetails-elseirogpshyhmffphsiejgydphd/Build/Products/Debug-iphonesimulator -F/Users/murthych/Library/Developer/Xcode/DerivedData/ClassifiedDetails-elseirogpshyhmffphsiejgydphd/Build/Products/Debug-iphonesimulator -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -filelist /Users/murthych/Library/Developer/Xcode/DerivedData/ClassifiedDetails-elseirogpshyhmffphsiejgydphd/Build/Intermediates/ClassifiedDetails.build/Debug-iphonesimulator/ClassifiedDetails.build/Objects-normal/i386/ClassifiedDetails.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.0 -framework XCTest -framework CoreGraphics -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker /Users/murthych/Library/Developer/Xcode/DerivedData/ClassifiedDetails-elseirogpshyhmffphsiejgydphd/Build/Intermediates/ClassifiedDetails.build/Debug-iphonesimulator/ClassifiedDetails.build/Objects-normal/i386/ClassifiedDetails_dependency_info.dat -o /Users/murthych/Library/Developer/Xcode/DerivedData/ClassifiedDetails-elseirogpshyhmffphsiejgydphd/Build/Products/Debug-iphonesimulator/ClassifiedDetails.app/ClassifiedDetails
Mach-O-Linker error message
building for iOS Simulator, but linking against dylib built for MacOSX file '/Applications/Xcode.app/Contents/Developer/Library/Frameworks/XCTest.framework/‌​XCTest' for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) "
XCTest.framework needs to be linked only to the unit test target in your project. It should not be added to the UI application target.
What I have found is when adding XCTest.framework Xcode adds extra \ to Framework Search Paths
\"$(SDKROOT)/Developer/Library/Frameworks\"
\"$(DEVELOPER_LIBRARY_DIR)/Frameworks\"
$(DEVELOPER_FRAMEWORKS_DIR)
This causes linker issue,
ld: building for iOS Simulator, but linking against dylib built for MacOSX file '/Applications/Xcode.app/Contents/Developer/Library/Frameworks/XCTest.framework/XCTest' for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
To resolve this issue in XCode 5.1 goto the main ProjectWindow, Tab Build Settings -> Section Search Path -> Framework Search Paths and edit to remove \ appearing the paths.
Hope that helps!
Deleting the test target and creating a new one and then copying the tests over can fix this.
I suggest you to use xcode 5.02 stable version and then hopefully these Mac-O Linker errors will be resolved.same problems I am facing too before installing xcode 5.02.

Json in iOS5 showing error

"_OBJC_CLASS_$_SBJSON", referenced from:
Objc-class-ref in JparseViewController.o
Symbol(s) not found for architecture i386
Clang: error: linker command failed with exit code 1 (use -v to see invocation)
Ld /Users/mag1/Library/Developer/Xcode/DerivedData/Jparse-heknsvlbknssribatbwgkuefjoja/Build/Products/Debug-iphonesimulator/Jparse.app/Jparse_armv7 armv7 i386
cd "/Users/mag1/Documents/Xcode Projects/Jparse"
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/mag1/Library/Developer/Xcode/DerivedData/Jparse-heknsvlbknssribatbwgkuefjoja/Build/Products/Debug-iphonesimulator -F/Users/mag1/Library/Developer/Xcode/DerivedData/Jparse-heknsvlbknssribatbwgkuefjoja/Build/Products/Debug-iphonesimulator -filelist /Users/mag1/Library/Developer/Xcode/DerivedData/Jparse-heknsvlbknssribatbwgkuefjoja/Build/Intermediates/Jparse.build/Debug-iphonesimulator/Jparse.build/Objects-armv7/i386/Jparse.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/mag1/Library/Developer/Xcode/DerivedData/Jparse-heknsvlbknssribatbwgkuefjoja/Build/Products/Debug-iphonesimulator/Jparse.app/Jparse_armv7
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_SBJSON", referenced from:
objc-class-ref in JparseViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I got JSON framework files from downloaded example. The examples are working perfectly, but my project showing above errors.
Symbol(s) not found for architecture i386
The above error occurs in the following situation:
You were trying to run your application in the iPhone/iPad Simulator
The library was only built to run on the physical devices, and does not support being run in the Simulator.
To resolve this, you either need to add i386 to the Valid Architectures of the SBJSON library build target, or test your application using a physical device.
You didn't add the SBJSON.m file to your target. Check the properties panel for this file, and there should be a checkbox indicating which target it is assigned to. You may have simply forgotten to copy SBJSON.m into your project at all.
go to Projectapp -> Buildphases -> compileSources
here to add all .m files of JSON with + icon. problem will be resolved

Getting llvm-gcc-4.2 failed with exit error

I have no idea how to debug this, and I've been banging my head against the wall for hours. Here is the error I got:
Ld /Users/MyAccount/Library/Developer/Xcode/DerivedData/TAC-goimuvevceqxowccylmmpcflbtvz/Build/Products/Debug-iphonesimulator/TAC.app/TAC normal i386
cd "/Users/MyAccount/Desktop/Programming Stuff/iOS Programming/XCode 4/TAC"
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/MyAccount/Library/Developer/Xcode/DerivedData/TAC-goimuvevceqxowccylmmpcflbtvz/Build/Products/Debug-iphonesimulator -L/Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.0/Symbols/usr/lib "-L/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.3 (8J2)/Symbols/usr/lib" -F/Users/MyAccount/Library/Developer/Xcode/DerivedData/TAC-goimuvevceqxowccylmmpcflbtvz/Build/Products/Debug-iphonesimulator "-F/Users/MyAccount/Desktop/Programming Stuff/iOS Programming/XCode 4/TAC" -filelist /Users/MyAccount/Library/Developer/Xcode/DerivedData/TAC-goimuvevceqxowccylmmpcflbtvz/Build/Intermediates/TAC.build/Debug-iphonesimulator/TAC.build/Objects-normal/i386/TAC.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -D__IPHONE_OS_VERSION_MIN_REQUIRED=40300 -framework UIKit -framework Foundation -framework CoreGraphics -framework Security -framework CoreMotion -framework SystemConfiguration -framework CFNetwork -framework MobileCoreServices -lxml2.2 -lz.1.2.5 -o /Users/MasonSilber/Library/Developer/Xcode/DerivedData/TAC-goimuvevceqxowccylmmpcflbtvz/Build/Products/Debug-iphonesimulator/TAC.app/TAC
ld: warning: ignoring file /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.0/Symbols/usr/lib/libxml2.2.dylib, missing required architecture i386 in file
ld: warning: ignoring file /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.0/Symbols/usr/lib/libSystem.dylib, missing required architecture i386 in file
ld: in /Developer/Platforms/iPhoneOS.platform/DeviceSupport/3.0/Symbols/usr/lib/libobjc.A.dylib, missing required architecture i386 in file for architecture i386
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
Any help is really appreciated. I would normally spend more time working on my own to solve the problem, but I really have no idea where to start.
If you are building against Simulator then you explicitly need to add i386 as an valid architecture. Also check under platform you have "iphonesimulator". Just click on your project file and it will reveal Build settings in the right side editor. You will find these settings there. Hope it helps.
It is saying that there is a missing 32 bit Intel architecture in the relevant libraries.
I would ask why you are persisting with GCC 4.2 when LLVM 2.0 is the default compiler now and gcc development has been shut down (at Apple)
Have a go at switching to LLVM 2.1 and see if the problem remains.
You really need to be asking about this bug on the Apple Dev forums if it's important to you to use GCC as iOS 5 and XCode 4.2 are NDA
You have forgot to add any library.try to add a directory that what you have missed.It resolve this issue.

Resources