Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4 (final version) error when building

Tags:

xcode4

I can't seem to find the answer.

I've just used Xcode 4 final version and built an existing project that was built ok with Xcode 3, but got this error:

ld: library not found for -lSystem.B
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1    

But another project was built OK with Xcode 4.

I installed Xcode 4 by choosing the default options.

Do I miss to include a library or framework somewhere?

Could somebody please help. Thank you.

like image 547
Tanto Avatar asked Mar 16 '11 03:03

Tanto


4 Answers

Here's my solution for Xcode 4.0.2 with SDK 4.3 environment, but I believe it should also work on other setups.

  1. libSystem.B.dylib is not present under /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib, however it is present for lower SDK versions (e.g. iPhoneOS4.2.sdk)
  2. most of the cases libSystem.B.dylib is just a symbolic link to libSystem.dylib
  3. so in iPhoneSimulator4.3.sdk/usr/lib I've applied following command sudo ln -s libSystem.dylib libSystem.B.dylib and my simulator builds started to work again :)

NOTE: libSystem.B.dylib is used by Flurry and Urban Airship so you better don't delete the reference in project file (of course Urban Airship does not work under Simulator, but I think Flurry does. libSystem.B.dylib may also be required by other libraries you included to your project.

UPDATE: solution still works for iOS5 Simulator after upgrading to Xcode 4.3

UPDATE, March 9th, 2k12: for Xcode installations via App Store, prefix above path with /Applications/Xcode.app/Contents or the path where you've installed Xcode.app.

like image 68
matm Avatar answered Jan 04 '23 05:01

matm


Solved.

Turns out that there was a reference to libSystemB in my project (Don't know why it's there). After deleting the reference, it built well.

Thanks anyway guys!

like image 32
Tanto Avatar answered Jan 04 '23 05:01

Tanto


-weak_library /usr/lib/libSystem.B.dylib breaks the iOS Simulator. Use -weak-lSystem instead.

The quote belongs to gparker on the official dev forums.

like image 20
nicktmro Avatar answered Jan 04 '23 03:01

nicktmro


-weak_library /usr/lib/libSystem.B.dylib breaks the iOS Simulator. Use -weak-lSystem instead.

nicktmro got it right, especially when you are developing cocos2d projects using xcode 4.x

like image 29
gamefish Avatar answered Jan 04 '23 04:01

gamefish