was a library built with libc++ or libstdc++ on Mac

c++, clang, macos

Solution

Static library: `nm -a helloworld.a | grep __1`

If you see lines containing `__1`, e.g. `__121__basic_string`, then the library was compiled with libc++. However if none of the function signatures used C++ Standard Library types, then this may not work.

Dynamic library: `otool -L helloworld`

Look for dependency on libc++ or libstdc++ dylib.

Problem

How can I tell if a library has been built with libc++ or libstdc++ on mac? I have been using otool -L, but this does not seem to show it (mac has no ldd) If i have library X, I want to know if I have to rebuild it as I move from GCC to clang. I have built a number of libraries with GCC, mac libraries are generally built with clang AFAIK.

Original source

Related problems