Question

When I try to run my application in the iOS 4.3 simulator (Xcode 4.2), I crash when I hit @autoreleasepool{}, with:

dyld: lazy symbol binding failed: Symbol not found: _objc_autoreleasePoolPush

I looked around, and I see the workaround is to add libarclite_iphoneos.a. There's a version of this for the simulator, too, as libarclite_iphonesimulator.a.

I need to add both libraries to my project to make it run on both the simulator and hardware. But whichever I build, it complains that the other library is for an unsupported architecture.

For example, building for simulator:

ld: warning: ignoring file /Developer-4.2/Platforms/iPhoneOS.platform/
Developer/usr/lib/arc/libarclite_iphoneos.a, missing required architecture
i386 in file

How do I fix both of these simultaneously? Or should I just stick with the old NSAutoreleasePool syntax for now?

Was it helpful?

Solution

After a trials like clean, clean folder, resetting iPhone Simulator and even a restart, I changed the IPHONE_DEPLYMENT_TARGET on the target build setting down from iOS 5.0 to iOS 4.2. Worked.

OTHER TIPS

You can use the Other Linker Flags build setting to link in the library, and specialize the value based on whether it's "Any iOS" or "Any iOS Simulator".

You can also merge the two static libraries to one universal library. Go to the Terminal and say

lipo -create -output /where/you/want/it/libarclite_universal.a /Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/arc/libarclite_iphoneos.a /Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/arc/libarclite_iphonesimulator.a

You can verify the resulting file by saying (in Terminal)

file /where/you/put/it/libarclite_universal.a

It should output:

libarclite_universal.a: Mach-O universal binary with 3 architectures
libarclite_universal.a (for architecture i386):current ar archive random library
libarclite_universal.a (for architecture armv6):current ar archive random library
libarclite_universal.a (for architecture armv7):current ar archive random library

Since this lib is linked statically, your final app wont grow because of the included sim library since only whatever is needed by your app will get linked into your final app.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top