Search code examples
c++xcodemacoscmakedylib

How can I inspect DYLIB contents in terms of size?


After moving from a manually created Xcode project to a CMake-generated Xcode C++ project, my compiled binary DYLIB size has grown significantly: from about 35 MB to about 53 MB.

All the compilation and linking settings I could compare in Xcode projects look pretty much the same (including vs. not including debug symbols, optimization levels, etc.). I wonder if there are any tools to inspect DYLIB contents - what occupies size in the first place.


Solution

  • I would personally go with nm tool. You can inspect any DYLIB file iteratively, section-by-section or just print everything:

    nm -a /path/to/my/lib.dylib