views:

3124

answers:

2

I have an iPhone app that heavily relies on the OpenCV library; as such, I've compiled a static version of this library for inclusion with my app. The instructions for doing this are relatively straightforward: Using OpenCV on iPhone. The only gotcha I ran into was setting the linker flag, STANDARD_C_PLUS_PLUS_LIBRARY_TYPE to "standard". The app compiled and ran perfectly under OS 2.0 and 2.2.

After upgrading to SDK 3.0 and trying to re-compile my app, I'm running into an issue with this linker flag. I'm getting this error while linking:

ld: library not found for -lstdc++-static

It's also interesting that on my system, "libstdc++-static" is present under seemingly every iPhoneOS and iPhoneSimulator SDK except for iPhoneOS.platform/SDKs/iPhoneOS3.0.sk. Here are the search results:

$ locate libstdc++-static
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/lib/libstdc++-static.a
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.1.sdk/usr/lib/libstdc++-static.a
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.1.sdk/usr/lib/libstdc++-static.a
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.sdk/usr/lib/libstdc++-static.a
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/usr/lib/libstdc++-static.a
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.1.sdk/usr/lib/libstdc++-static.a
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk/usr/lib/libstdc++-static.a
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.sdk/usr/lib/libstdc++-static.a
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/usr/lib/libstdc++-static.a
/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libstdc++-static.a
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libstdc++-static.a
/usr/lib/libstdc++-static.a

I'm pretty baffled and haven't been able to find any answers on Google or iPhone dev forums. I'd really appreciate if someone could shed some light here.

Thanks!

A: 

That is truly puzziling, only thing I can think of is that /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk is not in your library search path but that would be very unlikely.

hhafez
I was trying to compile for iPhoneOS, not simulator. It needs to work for both.
pix0r
You are right, that was just a slipped past me, where is the library for iphone then? It doesn't appear in your list....
hhafez
Right, that was the problem ;) It seems like Apple has left it out in SDK 3.0 - probably just a mistake. It turns out that the 2.2 version of the library works just fine in 3.0.
pix0r
+1  A: 

Just a guess - try adding one of the directories to the 'Library Search Paths' option in Build Properties?

John
This worked! Thanks! I was trying to copy the file from an older SDK, but that wasn't working (though I'm not sure if I needed to do the equivalent of `ldconfig` to re-scan that directory, so I was about to reboot instead)
pix0r
great! I first started thinking about LD_LIBRARY_PATH then figured it's probably in the properties.
John