I just upgraded to iPhone SDK 4.0, and recompiled my static libraries and app, and when I run it on a device with iOS 3.1.3 (using deployment target 3.0), it says:
dyld: lazy symbol binding failed: Symbol not found: ___sync_fetch_and_add_4
Referenced from: /var/mobile/Applications/7CA42202-DA9D-4A10-918D-593362E18000/renderer.app/renderer
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: ___sync_fetch_and_add_4
Referenced from: /var/mobile/Applications/7CA42202-DA9D-4A10-918D-593362E18000/renderer.app/renderer
Expected in: /usr/lib/libSystem.B.dylib
I found this blog post, but it doesn’t seem to give any advice other than
-
try to use gcc 4.0 instead of 4.2, and
-
it should have been fixed in the SDK 4.0.
It appears that the code he points to was fixed in SDK 4.0 (and his example of a minimal app that exhibits this behavior works fine for me), but I’m still getting this error.
It turns out that I had only compiled the app with deployment target of 3.0; once I also compiled the libraries with deployment target of 3.0, it worked correctly.