I have been searching up and down stackoverflow and Google for the correct way to compile and add the libtiff
library to my existing iOS project in Xcode.
What I have done so far:
EDIT:
I have downloaded libtiff to my Mac after deciding to follow this advice on stackoverflow. I used version 3.9.6 and built it like in this tutorial and its sequel about SDK5. There, in the comments, I found a script I could adapt. I have added the resulting "dependencies" folder to my Xcode project, almost like rakmoh suggested.
However, I got linker errors as soon as I #include tiffio.h
:
Undefined symbols for architecture armv7: "_inflateEnd", referenced from:
_PixarLogCleanup in libtiff.a(tif_pixarlog.o)
_ZIPSetupEncode in libtiff.a(tif_zip.o)
.
... some more...
.
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I also tried the newest version of libtiff
, but that did not change a thing, so I went back to 3.9.6, as it is compatible with the other softwares in the project. Then I asked a colleague who found out it was the libz
library missing. From the log files he saw it must have been there during the compilation of libtiff
and it was still missing for the linker in my Xcode project. And lo! When I added it to the frameworks (with the little + sign and browse the list for libz.dylib
), my empty test project compiled.
Before writing an answer, I would like to do some more testing, but I have already updated the successful shell script to pastebin.
Thank you for your help!