dyld: Library not loaded: /usr/lib/libc++abi.dylib
Asked Answered
M

2

5

I've build my project on xcode 4.2.

I selected iPhone 4.3 simulator and build the project.

Then the error occured.

dyld: Library not loaded: /usr/lib/libc++abi.dylib
  Referenced from: /Users/Player/Library/Application Support/iPhone Simulator/4.3.2/Applications/CF49143F-07C9-4609-AADB-82DD3AEAF6D9/Mahjang.app/Mahjang
  Reason: image not found

How can I solve this problem?

Need your help.

Myth answered 18/11, 2011 at 5:47 Comment(0)
L
12

I ran into this too: installed XCode 4.2 on Snow Leopard, and ran my app on the simulator. 5.0 simulator works, but forces it into Portrait mode (separate issue). The immediate problem was all the 4.x simulators that worked fine under XCode 4.1 would boot the app to the Default.png splash screen, and then just crash, with the disassembly showing:

int 3
nop

And the stack trace showing __dyld_dyld_fatal_error. Looking in gdb showed the most useful information posted in the question above.

Copying that llvm link to libc++abi.dylib into /usr/lib works, but there is a safer solution:

Answer: Add -Wl,-no_implicit_dylibs to "Other Linker Flags" in your build settings.

Libra answered 3/12, 2011 at 12:35 Comment(2)
when I add this to my other linker flags, there is already "-lz" before that, so it looks like this: "-lz,-WI,-no_implicit_dylibs" but it gives the error "library not found for "-lz,-WI,-no_implicit_dylibs". Removing the "-lz" flag results in 7 errors, is there a way around this? I'd rather not download the source mentioned in the other answer to make this work. Thanks!Chuch
Aha, it should be: "-lz -Wl,-no_implicit_dylibs" W then lowercase L and no comma after -lzChuch
P
6

This is what I found out. Download zip from the below URL.

http://howardhinnant.github.io/libcppabi.zip

cp cxxabi.h to /usr/include, and cp libc++abi.dylib to /usr/lib. Now your simulator should work.

The URL seems a little funky to me, being a very non-offical location. But I got it from http://libcxx.llvm.org/ so I'm going to say it is trustworthy. Don't know what the story is here with why this is necessary.

Prognostication answered 22/11, 2011 at 20:12 Comment(1)
It seems Snow Leopard users have to go this route because Lion includes this automatically. From the page linked above: "To build on Mac OS X 10.6 (Snow Leopard), you need a helper library and header found here. cp cxxabi.h to /usr/include, and cp libc++abi.dylib to /usr/lib. On Mac OS X 10.7 (Lion) and later, this helper library and header are already installed for you."Chuch

© 2022 - 2024 — McMap. All rights reserved.