问题
I have a C++ project which is compiled to a universal shared library. Now, I also want a static library for the same. When I reuse the shared library Xcode project to create static library, the size of static library created is much smaller (~ 3MB) as compared to when I create a separate Xcode Static Library project to compile my code (~19 MB). (universal - 32 & 64 bit)
Here is what I tried with the shared library project:
xcodebuild -project MyLibrary.xcodeproj build MACH_O_TYPE=staticlib EXECUTABLE_EXTENSION=a GCC_ENABLE_SYMBOL_SEPARATION=NO PACKAGE_TYPE=com.apple.package-type.static-library
Both the libraries work fine when linked to any C++ project. otool
gives same output for both libraries
Also, I tried creating the static build using Qt Creator and again the library size was around 3 MB (32 + 64 bit)
I wonder what is the difference between the two static libraries if they both link fine.
The size of the same static library when compiled on Linux is aroung ~4MB (32 + 64 bit)
来源:https://stackoverflow.com/questions/31770110/much-larger-static-library-generated-by-xcode