I have a project that creates a static library (.a).
This static library requires libz.dylib to libz.dylib present in the application. Now I'm trying to do it. Link libz.dylib to the static library itself so that developers who use my static library do not have to link libz.dylib to their application.
Here are what I have tried so far and the errors I came across:
If I just bind the build phase of libz.dylib to the Link Binary with Libraries of the static library object, and then use the final static library with the application:
Undefined symbols for i386 architecture:
"_ deflate" referenced by:
If I also include -lz in the Other Linker Flags of the Static Library Target object, it gives an error while creating the static library itself:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: cannot find file for: -lz /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/ bin / libtool: file: -lz is not an object file (not allowed in the library)
I think it is possible to link a dynamic library to a static library, and if so, how?
source share