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.
Here's how to check if a library is installed: Type ldconfig -p | grep libc++ into the terminal. It does not matter what system you are using. If libc++ is not installed, the terminal will not say anything.
Most implementations of libstdc++ depend on libc, so they require it. The C++ standard includes most of the C standard library. So it's kind of a dependency and technically it's part of the C++ standard library.
Libstdc++ is part of the GCC sources. You should first unpack the GCC tarball and change to the gcc-9.2.
libc++abi is a new implementation of low level support for a standard C++ library. All of the code in libc++abi is dual licensed under the MIT license and the UIUC License (a BSD-like license).
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.
For dynamic libraries, otool -L
would show libstdc++
if it were built against that library (i.e. if it were C++).
For static libraries, the question doesn't make sense. Static libraries aren't built against other libraries.
And you should not have to rebuild anything just because you're changing compilers. There's just the one, system-wide C++ library and it has a stable ABI.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With