You are right, iOS already contains libz.dylib
. As such, you should be able to link to it:
- In "Build Phases" remove
libz.dylib
you've added; - In "Build Settings" locate setting named "Other Linker Flags" and add
-lz
to it; - Note that
zlib.h
is also available as part of iOS SDK, so no need to have another one.
This should allow your app to be built for both Simulator and the device.
EDIT
The above doesn't resolve the issue. The actual problem is caused by zlib-dynamic
OpenSSL Configure. With this option, OpenSSL tries to load libz.so
at runtime (and fails to do so because it is named libz.dylib
on iOS). This is easy to fix by replacing zlib-dynamic
with zlib
and re-building OpenSSL. If using newly built library results in linker errors please check the first part of the answer.