I am using apple gcc to compile dylib, which I am going to redistribute. For various reasons, I use some libraries, say libz , to make it simple.
Since this library is not usually found on a Mac system, I want a static link to use characters in dylib by passing the path to .a-file to simplify the deployment.
Now the linker is linked in all the characters from lib to the resulting dylib, although I am only referring to a subset. In linux, I never encountered this problem, the linker happily discards all characters without links and creates a very thin executable, so this should be possible. The dylib file that I have is now ~ 10 times larger than needed.
I tried playing with the -dead_code flag, but to no avail. Maybe I just don't get it?
Does anyone know how to solve this?
source share