This is the error log, which I got
Ld /Users/apple/Library/Developer/Xcode/DerivedData/SMTPExample-dkhosyetbsajvtcdyyalnckswjgd/Build/Products/Debug-iphonesimulator/SMTPExample.app/SMTPExample normal i386
cd /Users/apple/Desktop/SMTPExample
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/xcode4/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/xcode4/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/xcode4/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 -arch i386 -isysroot /xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/apple/Library/Developer/Xcode/DerivedData/SMTPExample-dkhosyetbsajvtcdyyalnckswjgd/Build/Products/Debug-iphonesimulator -F/Users/apple/Library/Developer/Xcode/DerivedData/SMTPExample-dkhosyetbsajvtcdyyalnckswjgd/Build/Products/Debug-iphonesimulator -F/Users/apple/Desktop/SMTPExample -filelist /Users/apple/Library/Developer/Xcode/DerivedData/SMTPExample-dkhosyetbsajvtcdyyalnckswjgd/Build/Intermediates/SMTPExample.build/Debug-iphonesimulator/SMTPExample.build/Objects-normal/i386/SMTPExample.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework Security -framework CFNetwork -framework UIKit -framework Foundation -framework CoreGraphics -framework DropboxSDK -o /Users/apple/Library/Developer/Xcode/DerivedData/SMTPExample-dkhosyetbsajvtcdyyalnckswjgd/Build/Products/Debug-iphonesimulator/SMTPExample.app/SMTPExample
ld: duplicate symbol _EstimateBas64EncodedDataSize in /Users/apple/Desktop/SMTPExample/DropboxSDK.framework/DropboxSDK and /Users/apple/Library/Developer/Xcode/DerivedData/SMTPExample-dkhosyetbsajvtcdyyalnckswjgd/Build/Intermediates/SMTPExample.build/Debug-iphonesimulator/SMTPExample.build/Objects-normal/i386/Base64Transcoder.o for architecture i386
collect2: ld returned 1 exit status
Command /xcode4/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
This is a linker error (the "ld" in the output indicates this, because the output error has been generated by the GNU linker program).
What has happened is that two identical declarations have been compiled separately from two separate source code files. One of these source files might be named Base64Transcoder.m or Base64Transcoder.cpp (as the compiled file that's caused the problem is Base64Transcoder.o). The declaration in question is _EstimateBas64EncodingDataSize. This symbol is being declared multiple times within different source code files, and then the linker is throwing an error because the two compiled source code files are different. You need to have a look through the entire source code that's being compiled and resolve the conflict.
Hope this helps and makes sense, I've always found linker issues difficult to understand and deal with. I'd really strongly suggest reading about the linker stages of program compilation for C/C++/Objective-C code (this is a very good guide). Then you should be able to better understand what's going on under the hood! :)
Related
Last week I was working on a project. Today, I reopened the project and tried to build it again. But I received an error message. I don't understand why I got this message because I didn't change anything of the project. (I'm using XCode 4.3 with storyboards)
Ld /Users/mete/Library/Developer/Xcode/DerivedData/MySınav-ceckdqzcfyfgicaqrhloynhdnglw/Build/Products/Debug-iphonesimulator/MySınav.app/MySınav normal i386
cd /Users/mete/Documents/MySınav
setenv MACOSX_DEPLOYMENT_TARGET 10.6
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/iPhoneSimulator5.1.sdk -L/Users/mete/Library/Developer/Xcode/DerivedData/MySınav-ceckdqzcfyfgicaqrhloynhdnglw/Build/Products/Debug-iphonesimulator -F/Users/mete/Library/Developer/Xcode/DerivedData/MySınav-ceckdqzcfyfgicaqrhloynhdnglw/Build/Products/Debug-iphonesimulator -filelist /Users/mete/Library/Developer/Xcode/DerivedData/MySınav-ceckdqzcfyfgicaqrhloynhdnglw/Build/Intermediates/MySınav.build/Debug-iphonesimulator/MySınav.build/Objects-normal/i386/MySınav.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100 -lsqlite3 -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/mete/Library/Developer/Xcode/DerivedData/MySınav-ceckdqzcfyfgicaqrhloynhdnglw/Build/Products/Debug-iphonesimulator/MySınav.app/MySınav
ld: duplicate symbol _counter in /Users/mete/Library/Developer/Xcode/DerivedData/MySınav-ceckdqzcfyfgicaqrhloynhdnglw/Build/Intermediates/MySınav.build/Debug-iphonesimulator/MySınav.build/Objects-normal/i386/examPaused.o and /Users/mete/Library/Developer/Xcode/DerivedData/MySınav-ceckdqzcfyfgicaqrhloynhdnglw/Build/Intermediates/MySınav.build/Debug-iphonesimulator/MySınav.build/Objects-normal/i386/examSelf.o for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The error message is pretty clear - you have two global symbols with the same name (_counter) defined in both examPaused.o and examSelf.o. This can happen because you have two global variables or non-static functions with the same name defined separately, or more commonly when you define something in a header file which then gets included/imported into two or more source files.
Refer to this solution that i have provided you at the following link.This can help you
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1
I'm trying to use Objective-Zip on an IOS5 iPhone application and I get the following linkage error when I build my project:
----------- ***********---------------
Ld /Users/amirpeivandi/Library/Developer/Xcode/DerivedData/Zarvaragh-czcfescrnmgrljfojncagweywohi/Build/Products/Debug-iphonesimulator/Zarvaragh.app/Zarvaragh normal i386
cd /Users/amirpeivandi/Documents/iPhoenApps/Zarvaragh
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/amirpeivandi/Library/Developer/Xcode/DerivedData/Zarvaragh-czcfescrnmgrljfojncagweywohi/Build/Products/Debug-iphonesimulator -F/Users/amirpeivandi/Library/Developer/Xcode/DerivedData/Zarvaragh-czcfescrnmgrljfojncagweywohi/Build/Products/Debug-iphonesimulator -filelist /Users/amirpeivandi/Library/Developer/Xcode/DerivedData/Zarvaragh-czcfescrnmgrljfojncagweywohi/Build/Intermediates/Zarvaragh.build/Debug-iphonesimulator/Zarvaragh.build/Objects-normal/i386/Zarvaragh.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=40300 -lz -framework CoreGraphics -framework MobileCoreServices -framework SystemConfiguration -framework CFNetwork -framework UIKit -framework Foundation -o /Users/amirpeivandi/Library/Developer/Xcode/DerivedData/Zarvaragh-czcfescrnmgrljfojncagweywohi/Build/Products/Debug-iphonesimulator/Zarvaragh.app/Zarvaragh
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_ZipFile", referenced from:
objc-class-ref in MainPageController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
----------- ***********---------------
I have no problem running the Objective-Zip application that comes with the code and I have checked my code, my project settings and all I could think of and the two projects (mine and default Objective-Zip iPhone project) have the same identical settings!
Any pointer would be greatly appreciated. I've been stuck for last couple of days on this silly thing. I've seen a few posts pointing to architecture supports and ARC setting but again I have two projects the way I see them identical one mine that is not compiling and one the one from Objective-Zip project that compiles and runs just fine!
Thx
Amir
Are you sure you have linked the Objective-Zip library in your project ? Because from the error it seems like it's not linked.
Sorry I know this has been covered all over the place, only I can't fix this to save my life.
If someone could explain clearly what I might have done and what I might be able to do to fix this I would be forever grateful.
Here is my error:
Command /Xcode 4/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
ld: duplicate symbol _OBJC_IVAR_$_sunnyHillsTL._tileMap in /Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Products/Debug-iphoneos/libcocos2d libraries.a(sunnyHillsTL.o) and /Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Intermediates/workingTitle.build/Debug-iphoneos/workingTitle.build/Objects-normal/armv7/sunnyHillsTL.o
Ld /Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Products/Debug-iphoneos/workingTitle.app/workingTitle normal armv7
cd "/Users/kahanejosh/Documents/iPhone:Mac Dev/Working Title/workingTitle"
setenv IPHONEOS_DEPLOYMENT_TARGET 3.0
setenv PATH "/Xcode 4/Platforms/iPhoneOS.platform/Developer/usr/bin:/Xcode 4/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
"/Xcode 4/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2" -arch armv7 -isysroot "/Xcode 4/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk" -L/Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Products/Debug-iphoneos -F/Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Products/Debug-iphoneos -filelist /Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Intermediates/workingTitle.build/Debug-iphoneos/workingTitle.build/Objects-normal/armv7/workingTitle.LinkFileList -dead_strip -all_load -ObjC -miphoneos-version-min=3.0 -framework CoreGraphics -framework Foundation -framework OpenGLES -framework QuartzCore -framework UIKit -framework AudioToolbox -framework OpenAL -lz -framework AVFoundation "-lcocos2d libraries" -o /Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Products/Debug-iphoneos/workingTitle.app/workingTitle
ld: duplicate symbol _OBJC_IVAR_$_sunnyHillsTL._tileMap in /Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Products/Debug-iphoneos/libcocos2d libraries.a(sunnyHillsTL.o) and /Users/kahanejosh/Library/Developer/Xcode/DerivedData/workingTitle-cawhuhbkmwcesmbqxvkbkbatdbze/Build/Intermediates/workingTitle.build/Debug-iphoneos/workingTitle.build/Objects-normal/armv7/sunnyHillsTL.o
collect2: ld returned 1 exit status
Command /Xcode 4/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
It looks like you have two targets set up and your source is getting used in both. So, you create a static library with the sunnyHillsTL class that gets put into libcocoas2d libraries.a and then you are using the same object file as well. Either don't directly use the class in your target (don't add the class to the target) if you're using the library, or don't have this class be compiled as part of the static library.
Seems like you have two instance variables named «tileMap» in your «sunnyHillsTL» class...
install Command Line Tools from your Xcode.
in Xcode -> Preferences -> Downloads -> Components ->Command Line Tools
i downloaded a project and i want to try it, but when i'm trying to compile it i get always this error:
Build TuneIn Radio of project TuneInRadio with configuration Release
Ld "build/Release-iphonesimulator/TuneIn Radio.app/TuneIn Radio" normal i386
cd /Users/marco/Downloads/projects
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/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk -L/Users/marco/Downloads/projects/build/Release-iphonesimulator -L/Users/marco/Downloads/projects -L/Users/marco/Downloads/projects/TuneInRadio-iphonesimulator -L/Users/marco/Downloads/projects/MMS/build/Release-iphonesimulator -L/Users/marco/Downloads/projects/ffmpeg/build/Release-iphonesimulator -F/Users/marco/Downloads/projects/build/Release-iphonesimulator -F/Users/marco/Downloads/projects -filelist "/Users/marco/Downloads/projects/build/TuneInRadio.build/Release-iphonesimulator/TuneIn Radio.build/Objects-normal/i386/TuneIn Radio.LinkFileList" -lTuneInRadio -llibmms -lffmpegLib -ObjC -Xlinker -objc_abi_version -Xlinker 2 -framework Foundation -framework CoreGraphics -framework QuartzCore -framework CoreFoundation -framework AudioToolbox -framework MediaPlayer -framework CoreLocation -framework UIKit -lz.1 -framework SystemConfiguration -framework MapKit -o "/Users/marco/Downloads/projects/build/Release-iphonesimulator/TuneIn Radio.app/TuneIn Radio"
ld: warning: directory '/Users/marco/Downloads/projects/TuneInRadio-iphonesimulator' following -L not found
ld: warning: directory '/Users/marco/Downloads/projects/MMS/build/Release-iphonesimulator' following -L not found
ld: library not found for -lTuneInRadio
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
Any advice on what kind of steps i can follow to reach the error ?
Thank's
The error indicates the problem:
ld: library not found for -lTuneInRadio
this means that your build/make is trying to find a library (called libTuneInRadio) to compile this program you're trying to build but it can't find it in the paths (the default ones + the ones described by the '-L' options on gcc call).
Not knowing any more about what you're compiling/building makes it impossible to say precisely what's happening other than you're missing this library.
Given the name of the library, it sounds like it should be part of the project you're trying to build (or maybe there is a related TuneInRadio-lib project), so I would suggest reading the README or BUILDING or similarly named file that might have come with the project to determine how to successfully compile this program.
I had the same problem compiling the project for iOS simulator, the problem is that the source code you downloaded does not contain the libTuneRadio.a library for TuneInRadio-iphonesimulator, so first create that folder and second move the libTuneRadio.a from TuneInRadio-iphoneos to the recently created folder. That should make it.
My application compiled successfully but it crashes as it cannot find any CasseteAudioPlayer class, so i guess there is still something wrong.
I've been fighting this for a few hours now and I'm getting fed up. My project builds fine with a debug simulator build , release simulator build and a debug device build, but for some reason it won't build with a release device build. I have a static library containing my cocos2d code, and another static library containing a game engine I wrote.
Because the game engine contains categories, I had to use the all_load linker flag to get it to run. Without this flag, the code builds fine. However, I get an unrecognized selector sent to instance exception when I try to run the game.
Here's the first build error:
ld: duplicate symbol _OBJC_CLASS_$_FontLabel in /Users/helixed/Dropbox/Documents/Development/iPhone/Cocos2d/build/Release-iphoneos/libcocos2d.a(FontLabel.o) and /Users/helixed/Dropbox/Documents/Development/iPhone/Cocos2d/build/Release-iphoneos/libcocos2d.a(FontLabel.o)
Ld build/Shapeless.build/Release-iphoneos/Shapeless.build/Objects-normal/armv6/Shapeless normal armv6
cd /Users/helixed/Dropbox/Documents/Development/iPhone/Apps/Shapeless
setenv IPHONEOS_DEPLOYMENT_TARGET 4.0
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-g++-4.2 -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk -L/Users/helixed/Dropbox/Documents/Development/iPhone/Apps/Shapeless/build/Release-iphoneos -F/Users/helixed/Dropbox/Documents/Development/iPhone/Apps/Shapeless/build/Release-iphoneos -filelist /Users/helixed/Dropbox/Documents/Development/iPhone/Apps/Shapeless/build/Shapeless.build/Release-iphoneos/Shapeless.build/Objects-normal/armv6/Shapeless.LinkFileList -dead_strip -ObjC -all_load -miphoneos-version-min=4.0 /Users/helixed/Dropbox/Documents/Development/iPhone/Cocos2d/build/Release-iphoneos/libChipmunk.a /Users/helixed/Dropbox/Documents/Development/iPhone/Cocos2d/build/Release-iphoneos/libcocos2d.a /Users/helixed/Dropbox/Documents/Development/iPhone/BlackHawk/build/Release-iphoneos/libBlackHawk.a -framework Foundation -framework UIKit -framework CoreGraphics -framework QuartzCore -framework OpenGLES -framework OpenAL -framework AVFoundation -framework AudioToolbox -lz -framework iAd -o /Users/helixed/Dropbox/Documents/Development/iPhone/Apps/Shapeless/build/Shapeless.build/Release-iphoneos/Shapeless.build/Objects-normal/armv6/Shapeless
ld: duplicate symbol _OBJC_CLASS_$_FontLabel in /Users/helixed/Dropbox/Documents/Development/iPhone/Cocos2d/build/Release-iphoneos/libcocos2d.a(FontLabel.o) and /Users/helixed/Dropbox/Documents/Development/iPhone/Cocos2d/build/Release-iphoneos/libcocos2d.a(FontLabel.o)
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-g++-4.2 failed with exit code 1
And here's the second:
Ld build/Shapeless.build/Release-iphoneos/Shapeless.build/Objects-normal/armv7/Shapeless normal armv7
cd /Users/helixed/Dropbox/Documents/Development/iPhone/Apps/Shapeless
setenv IPHONEOS_DEPLOYMENT_TARGET 4.0
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-g++-4.2 -arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk -L/Users/helixed/Dropbox/Documents/Development/iPhone/Apps/Shapeless/build/Release-iphoneos -F/Users/helixed/Dropbox/Documents/Development/iPhone/Apps/Shapeless/build/Release-iphoneos -filelist /Users/helixed/Dropbox/Documents/Development/iPhone/Apps/Shapeless/build/Shapeless.build/Release-iphoneos/Shapeless.build/Objects-normal/armv7/Shapeless.LinkFileList -dead_strip -ObjC -all_load -miphoneos-version-min=4.0 /Users/helixed/Dropbox/Documents/Development/iPhone/Cocos2d/build/Release-iphoneos/libChipmunk.a /Users/helixed/Dropbox/Documents/Development/iPhone/Cocos2d/build/Release-iphoneos/libcocos2d.a /Users/helixed/Dropbox/Documents/Development/iPhone/BlackHawk/build/Release-iphoneos/libBlackHawk.a -framework Foundation -framework UIKit -framework CoreGraphics -framework QuartzCore -framework OpenGLES -framework OpenAL -framework AVFoundation -framework AudioToolbox -lz -framework iAd -o /Users/helixed/Dropbox/Documents/Development/iPhone/Apps/Shapeless/build/Shapeless.build/Release-iphoneos/Shapeless.build/Objects-normal/armv7/Shapeless
ld: duplicate symbol _OBJC_CLASS_$_FontLabel in /Users/helixed/Dropbox/Documents/Development/iPhone/Cocos2d/build/Release-iphoneos/libcocos2d.a(FontLabel.o) and /Users/helixed/Dropbox/Documents/Development/iPhone/Cocos2d/build/Release-iphoneos/libcocos2d.a(FontLabel.o)
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-g++-4.2 failed with exit code 1
This is the only think keeping me from releasing, so I really appreciate the help.
Thanks.
I faced a similar problem, I had accidentally included (#import) the implementation file instead of the header file
When the compiler throws an error that 2 object files contain a duplicate symbol, check for how you have included (#import) the that duplicate symbol's class in the 2 implementation files.
I had this problem with adding both Facebook sdk and Dropbox sdk. The problem was both of the SDks are using having JSON lib so I removed one of them ans it works now.
Do you have it twice in your project structure? Check the left side of XCode and look through all the folders and make sure you don't have it in there multiple times.
Do you have a different set of device architectures (armv6, armv7, etc.) in your Release build than in your Debug build settings (either project, or target which overrides project settings)?
I think the solution to your problem lies in the unrecognized selector issue that you tried to solve using the -all_load flag. I use cocos2d-iphone in a static library and didn't need that flag. If you read up what it does, it should tell you that it's unlikely to be related to your problem:
What does the -all_load linker flag do?
It fixes linking to static libraries containing ONLY categories and NO classes. That certainly isn't true for cocos2d-iphone.
I recommend to figure out why you get unrecognized selector warnings without this flag. If necessary ask another question here.
You should also turn on the "Unrecognized Selector" build warning in the project's Build Settings, so that you get this warning while compiling as opposed to when it crashes while running the game (then it's too late and you wasted a lot of time). It's one of the settings I always turn on in an Xcode project.