Apple Mach-O Linker (id) Error - ios

I have an error below:
ld /Volumes/Data/Library/Developer/Xcode/DerivedData/uniText-cgynaitlevdrajfeoaldwldehaft/Build/Products/Debug-iphonesimulator/uniText.app/uniText normal i386
cd "/Volumes/Data/Documents/XCode Projects/Trans SMS"
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/iPhoneSimulator4.3.sdk -L/Volumes/Data/Library/Developer/Xcode/DerivedData/uniText-cgynaitlevdrajfeoaldwldehaft/Build/Products/Debug-iphonesimulator -F/Volumes/Data/Library/Developer/Xcode/DerivedData/uniText-cgynaitlevdrajfeoaldwldehaft/Build/Products/Debug-iphonesimulator -filelist /Volumes/Data/Library/Developer/Xcode/DerivedData/uniText-cgynaitlevdrajfeoaldwldehaft/Build/Intermediates/uniText.build/Debug-iphonesimulator/uniText.build/Objects-normal/i386/uniText.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework SystemConfiguration -framework MessageUI -framework AddressBook -framework AddressBookUI -framework CoreTelephony -lsqlite3.0 -framework UIKit -framework Foundation -framework CoreGraphics -o /Volumes/Data/Library/Developer/Xcode/DerivedData/uniText-cgynaitlevdrajfeoaldwldehaft/Build/Products/Debug-iphonesimulator/uniText.app/uniText
ld: duplicate symbol _OBJC_IVAR_$_FMDatabase.databasePath in /Volumes/Data/Library/Developer/Xcode/DerivedData/uniText-cgynaitlevdrajfeoaldwldehaft/Build/Intermediates/uniText.build/Debug-iphonesimulator/uniText.build/Objects-normal/i386/FMDatabase-566DC6D59187887D.o and /Volumes/Data/Library/Developer/Xcode/DerivedData/uniText-cgynaitlevdrajfeoaldwldehaft/Build/Intermediates/uniText.build/Debug-iphonesimulator/uniText.build/Objects-normal/i386/FMDatabase-566DC6D59187887D.o for architecture i386
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
Could someone help me out?
It used to work properly before.
I have no idea what I have changed in the project sources.
But I am sure that I never changed anything in that FMDatabase.h and .m.

The relevant portion of your error is ld: duplicate symbol _OBJC_IVAR_$_FMDatabase.databasePath. For some reason, the linker (ld) is trying to link FMDatabase twice. Check to see if you have multiple copies of it in your project.

I once got this error when I was initializing values to constants defined in the global scope in my .h file.
Solved the problem, by declaring them in the header, and initializing them in the .m file.

This is a quite old post, but maybe it still helps somebody.
Just had the same problem, for me the solution was: I accidently linked an .m file in one of the headers instead of the .h file. Just changed that to properly link the .h file.

Check if you import framework which required.

I solve the problem by updating my framework.

I solved by performing a Clean .
Then could Build.

Related

Apple Mach-O-Linker Error CocoaPods

I've been trying to get my app up and running. From what I could tell the app was missing Cocoapods as a dependency. So. I installed and added Cocoapods. But I'm still getting the same error for whatever reason. I'm an inexperienced developer trying to teach himself I must add.
Ld
/Users/bfarag/Library/Developer/Xcode/DerivedData/Umbrella-cspuzusfqmqgnwdqfhtiyivaqwke/Build/Products/Debug-iphonesimulator/Umbrella.app/Umbrella
normal i386
cd "/Users/bfarag/Desktop/The Nerdery/BRAVO.iOS.CodeChallenge"
export IPHONEOS_DEPLOYMENT_TARGET=7.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/iPhoneSimulator7.1.sdk
-L/Users/bfarag/Library/Developer/Xcode/DerivedData/Umbrella-cspuzusfqmqgnwdqfhtiyivaqwke/Build/Products/Debug-iphonesimulator
-F/Users/bfarag/Library/Developer/Xcode/DerivedData/Umbrella-cspuzusfqmqgnwdqfhtiyivaqwke/Build/Products/Debug-iphonesimulator
-filelist /Users/bfarag/Library/Developer/Xcode/DerivedData/Umbrella-cspuzusfqmqgnwdqfhtiyivaqwke/Build/Intermediates/Umbrella.build/Debug-iphonesimulator/Umbrella.build/Objects-normal/i386/Umbrella.LinkFileList
-Xlinker -objc_abi_version -Xlinker 2 -ObjC -lPods-Umbrella-AFNetworking -framework CoreGraphics -framework MobileCoreServices -framework Security -framework SystemConfiguration
-fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.0 -framework Accelerate -framework UIKit -framework Foundation -framework CoreGraphics -lPods -lPods-Umbrella -Xlinker -dependency_info -Xlinker /Users/bfarag/Library/Developer/Xcode/DerivedData/Umbrella-cspuzusfqmqgnwdqfhtiyivaqwke/Build/Intermediates/Umbrella.build/Debug-iphonesimulator/Umbrella.build/Objects-normal/i386/Umbrella_dependency_info.dat
-o /Users/bfarag/Library/Developer/Xcode/DerivedData/Umbrella-cspuzusfqmqgnwdqfhtiyivaqwke/Build/Products/Debug-iphonesimulator/Umbrella.app/Umbrella
ld: library not found for -lPods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This error usually occurs either when you don't have the correct frameworks (might be missing one) or when you don't have the right thing in linker flags.
Go to the main page for the app (on the navigation thing on the left click on your apps name or the top section) -> Build Settings and under Linker Flags, make sure there is nothing in your Other Linker Flags. I had this same error when I had -ObjC in my other Linker Flags.
You might also want to try adding -lPods to your Other Linker Flags or adding the CoreGraphics framework if you don't already have it.
Good luck
Open workspace file, not project file. Cocoapods automatically creates a xcworkspace file on the same directory as xcproject file.
Xcode started displaying this message and I tried pretty much everything to solve it. What finally did the trick for me was deleting all content from ~/Library/Developer/Xcode/DerivedData/

(Cordova) Xcode 5.1 Error Apple Mach-O Linker error libCordova.a file not found

I recently tried to archive my product in order to submit it to the app store, but came across this error that has eaten up my time. The error goes as follows:
Ld
/Users/guled/Library/Developer/Xcode/DerivedData/Alter-arpezfgnfzcguefnjpllgwzddkld/Build/Intermediates/ArchiveIntermediates/Alter-App\
Store/IntermediateBuildFilesPath/Alter.build/App\
Store-iphoneos/Alter.build/Objects-normal/armv7/Alter normal armv7
cd /Applications/MAMP/htdocs/Alter/platforms/ios
export IPHONEOS_DEPLOYMENT_TARGET=6.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.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 armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk
-L/Users/guled/Library/Developer/Xcode/DerivedData/Alter-arpezfgnfzcguefnjpllgwzddkld/Build/Intermediates/ArchiveIntermediates/Alter-App\
Store/BuildProductsPath/App\ Store-iphoneos
-F/Users/guled/Library/Developer/Xcode/DerivedData/Alter-arpezfgnfzcguefnjpllgwzddkld/Build/Intermediates/ArchiveIntermediates/Alter-App\
Store/BuildProductsPath/App\ Store-iphoneos -filelist
/Users/guled/Library/Developer/Xcode/DerivedData/Alter-arpezfgnfzcguefnjpllgwzddkld/Build/Intermediates/ArchiveIntermediates/Alter-App\
Store/IntermediateBuildFilesPath/Alter.build/App\
Store-iphoneos/Alter.build/Objects-normal/armv7/Alter.LinkFileList
-dead_strip -weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem -force_load /Users/guled/Library/Developer/Xcode/DerivedData/Alter-arpezfgnfzcguefnjpllgwzddkld/Build/Intermediates/ArchiveIntermediates/Alter-App\
Store/BuildProductsPath/App\ Store-iphoneos/libCordova.a -ObjC
-fobjc-arc -fobjc-link-runtime -miphoneos-version-min=6.0 -framework AssetsLibrary
/Users/guled/Library/Developer/Xcode/DerivedData/Alter-arpezfgnfzcguefnjpllgwzddkld/Build/Intermediates/ArchiveIntermediates/Alter-App\
Store/BuildProductsPath/Release-iphoneos/libCordova.a -framework
CoreGraphics -framework MobileCoreServices -framework CoreLocation
-Xlinker -dependency_info -Xlinker /Users/guled/Library/Developer/Xcode/DerivedData/Alter-arpezfgnfzcguefnjpllgwzddkld/Build/Intermediates/ArchiveIntermediates/Alter-App\
Store/IntermediateBuildFilesPath/Alter.build/App\
Store-iphoneos/Alter.build/Objects-normal/armv7/Alter_dependency_info.dat
-o /Users/guled/Library/Developer/Xcode/DerivedData/Alter-arpezfgnfzcguefnjpllgwzddkld/Build/Intermediates/ArchiveIntermediates/Alter-App\
Store/IntermediateBuildFilesPath/Alter.build/App\
Store-iphoneos/Alter.build/Objects-normal/armv7/Alter
This error also follows:
ld: file not found:
/Users/guled/Library/Developer/Xcode/DerivedData/Alter-arpezfgnfzcguefnjpllgwzddkld/Build/Intermediates/ArchiveIntermediates/Alter-App
Store/BuildProductsPath/App Store-iphoneos/libCordova.a clang: error:
linker command failed with exit code 1 (use -v to see invocation)
Can someone help me?
This issue was driving me crazy for hours. Apps builds and runs fine. Cannot create archive. Cordova 3.5 and Xcode 5.1.1.
I was able to resolve this issue by using the solution in the comments from Somnibyte. I was creating a "Distribution" build configuration (like I always do), and I was unable to create an archive from this "Distribution" configuration. Spent hours tinkering and trying. I finally found the comment from Somnibyte, attempted to simply archive the "Release" build configuration instead, and... BAM! It worked! Thank you thank you thank you Somnibyte. Hope this saves someone else some time.
I think the issue may be here:
Have you tried manually adding the libcordova.a file to the xcode project? Thats all I can think of, having no experience with cordova myself.
The error here seems to be that xcode is just failing to find the libcordova.a, so this link may help some.
https://developer.apple.com/library/ios/recipes/xcode_help-project_editor/Articles/AddingaLibrarytoaTarget.html

xcode library not found for -lobjc

I am getting this error when I am trying to run it on my device, however it working fine when I run it on simulator. Is this a tool chain error or SDK header error? Below is the error message I obtain when compiling.
Error Message:
Ld /Users/KhangYu/Library/Developer/Xcode/DerivedData/mobiletimetec-bbuzqjqgmijmomgdmvebkbyasqii/Build/Intermediates/mobiletimetec.build/Debug-iphoneos/mobiletimetec.build/Objects-normal/armv7/mobiletimetec normal armv7
cd /Users/KhangYu/Desktop/KPTesting/setting
setenv IPHONEOS_DEPLOYMENT_TARGET 6.1
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.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 armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -L/Users/KhangYu/Library/Developer/Xcode/DerivedData/mobiletimetec-bbuzqjqgmijmomgdmvebkbyasqii/Build/Products/Debug-iphoneos -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/lib/system -F/Users/KhangYu/Library/Developer/Xcode/DerivedData/mobiletimetec-bbuzqjqgmijmomgdmvebkbyasqii/Build/Products/Debug-iphoneos -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -filelist /Users/KhangYu/Library/Developer/Xcode/DerivedData/mobiletimetec-bbuzqjqgmijmomgdmvebkbyasqii/Build/Intermediates/mobiletimetec.build/Debug-iphoneos/mobiletimetec.build/Objects-normal/armv7/mobiletimetec.LinkFileList -dead_strip -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=6.1 -framework SystemConfiguration -framework AVFoundation -lsqlite3.0 -framework MapKit -framework CoreLocation -framework MessageUI -framework QuartzCore -framework Security -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/KhangYu/Library/Developer/Xcode/DerivedData/mobiletimetec-bbuzqjqgmijmomgdmvebkbyasqii/Build/Intermediates/mobiletimetec.build/Debug-iphoneos/mobiletimetec.build/Objects-normal/armv7/mobiletimetec
ld: library not found for -lobjc
clang: error: linker command failed with exit code 1 (use -v to see invocation)
//-- END --
This is going to be the death of me. Any idea on how to solve it? Your help will be greatly appreciated.
Thanks in advance.
Solution
Thanks Kevin and Jasper Blues reply and also thanks Reno Jones to edit my post.
After hours of trying to fix this, I renamed the file "libobjc.A.dylib" to "libobjc.dylib"and the error disappear.
P/S: "libobjc.A.dylib" - located in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer‌​/SDKs/*/usr/lib/, thanks again to Kevin.
My guess is that it works on the Simulator, but not the device because you've specified separate 'OTHER LINKER FLAGS' for both 'Debug' and 'Release' configurations. You'd usually do this if you're linking in a debug framework such as 'Reveal', 'DCIntrospect', etc.
The one for 'Release' looks to be incorrect. It should be '-Objc' and not '-lObjc' - we're telling the compiler that we're using Objective-C itself, and not to load a library called 'Objc'.
To correct:
In Xcode, click on the target for your App.
Open the 'Build Settings' tab.
Search for 'Other linker flags' - so you're not overwhelmed by options.
Correct the 'Release' config. Change '-lObjc' to '-Objc'
There is no need to rename "libobjc.A.dylib", just re-link it like : ln -s ./libobjc.A.dylib ./libobjc.dylib

RestKit Linker error

I have been following the RestKit installation instructions but I now have an error when I try to build the app. This is for ios, iPad specific.
I get "Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1"
Description:
Ld build/Debug-iphonesimulator/iDoor.app/iDoor normal i386
cd "/Users/User/Dropbox/darxstudios/FatCow Games/iDoor"
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/User/Dropbox/darxstudios/FatCow Games/iDoor/build/Debug-iphonesimulator" "-F/Users/User/Dropbox/darxstudios/FatCow Games/iDoor/build/Debug-iphonesimulator" -filelist "/Users/User/Dropbox/darxstudios/FatCow Games/iDoor/build/iDoor.build/Debug-iphonesimulator/iDoor.build/Objects-normal/i386/iDoor.LinkFileList" -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -ObjC - all_load -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -framework Security -lxml2 -framework SystemConfiguration -framework MobileCoreServices -framework CoreData -framework CFNetwork -framework UIKit -framework Foundation -framework CoreGraphics -o "/Users/User/Dropbox/darxstudios/FatCow Games/iDoor/build/Debug-iphonesimulator/iDoor.app/iDoor"
I am not an expert of using XCode but it almost appears that it wants to deploy as MAC OSX but I have the targets setup for ios. Any help would be appreciated.
Also I do not have RestKit.framework added (the mac osx version) and i was following the instructions for installing RestKit here: https://github.com/RestKit/RestKit/wiki/Installing-RestKit-in-Xcode-4.x
After looking further i notice that in the "Link Binary With Libraries" the libRestKit.a is red. I am thinking that may be a part or the whole issue...
So I found the answer, I can't believe I missed this very simple thing. Hopefully this will help anyone else who has this issue.
In the Linker section ensure that it is "Other Linker Flags" -ObjC -all_load
I mistakenly entered -ObjC - all_load
The space after the second dash was the cause.
I forgot to include libRestKit.a and receive the same error. Adding the image to help others like me.

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