UPDATE: please leave a comment when you have this working without problems on your system. That would confirm that this is a problem in my setup, rather than a bug in XCode.
After upgrading my development system to XCode 4.5.1, and compiling with IOS SDK 6.0, I get the following errors when running on the IOS 4.3 simulator:
dyld: lazy symbol binding failed: Symbol not found: _objc_release
Referenced from: /Users/baraupp/Library/Application Support/iPhone Simulator/4.3.2/Applications/AFD73AB4-7047-468B-A20B-9C941850ED3C/Flyskyhy.app/Flyskyhy
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/Foundation.framework/Foundation
dyld: Symbol not found: _objc_release
Referenced from: /Users/baraupp/Library/Application Support/iPhone Simulator/4.3.2/Applications/AFD73AB4-7047-468B-A20B-9C941850ED3C/Flyskyhy.app/Flyskyhy
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/Foundation.framework/Foundation
I have set the deployment target to 4.3, and I use ARC in the project, with some files on -fno-objc-arc. Compiling and linking succeeds without errors, it fails when trying to run on the simulator. It used to work fine before I upgraded.
EDIT:
I found a similar Stackoverflow question that asks almost exactly the same thing, and its answer suggests adding -fobjc-arc to the other linker flags. Unfortunately, that did not solve my problem. EDIT: I checked the flags that are actually used in the link phase, and the -fobjc-arc flag is present while linking, also without me adding -fobjc-arc explicitly.
As suggested by Brad in the comments, I added the library libarclite_iphoneos.a
to the project, but that did not help either. I found that library in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc, which is a weird location in my view, but I could not find it anywhere else.
I also did 'nm' on that library, and it does not define the missing _objc_retain
symbol either. It does define a _objc_retain$non_lazy_ptr
, though, not sure what that means.
EDIT: I found out that the library gets ignored:
ld: warning: ignoring file libarclite_iphoneos.a, missing required architecture i386 in file libarclite_iphoneos.a
So obviously, it is not the correct file. But I cannot find the same file anywhere else on my system (I have searched with 'find').
Any ideas?