# Which LibTIFF to use?

• We are building Qt 4.8.7 ourselves (and cannot upgrade to 5.X yet), and during the configure step, one has the options

    -no-libtiff ........ Do not compile TIFF support.
-qt-libtiff ........ Use the libtiff bundled with Qt.
+  -system-libtiff .... Use libtiff from the operating system.
See http://www.libtiff.org


From src\3rdparty\libtiff\VERSION I learn that the LibTIFF version that comes with Qt 4.8.7 is LibTIFF 4.0.3 from 22 september 2012. From http://www.simplesystems.org/libtiff/ I learn that the latest version is 4.0.7.

I am wondering what are the reasons for choosing either -qt-libtiff or -system-libtiff (which appears to be the default). The only reason I can think of for prefering -system-libtiff over -qt-libtiff is that it allows to use a more recent version of LibTIFF.

What could be reasons for choosing either -qt-libtiff or -system-libtiff? What are the advantages or disadvantages for a particular choice?

• Hi,

It allows to build the tiff plugin on platforms that don't provide libtiff natively like Windows.

• Hmm... I am rather confused now :-) With Qt 4.8.7 comes LibTIFF 4.0.3 (under src\3rdparty\libtiff). If I use -qt-libtiff, then if I understand things correctly, it will compile thát LibTIFF to a plugin. But what if I want to use my own build of a later version of LibTIFF (say 4.0.7)? Is that what -system-libtiff is for? If 'yes', then how does Qt know where my own compiled LibTiff 4.0.7 is located?

• You can use the -I and -L options to pass the path to your custom build of libtiff.

• Ok. Thanks. That makes sense. However, my original question remains: are there any reasons for preferring -system-libtiff over -qt-libtiff? The only one that I can think of is the ability to use a more recent version of LibTIFF.

• That's the usual yes.

And beside more recent version, there are also the security fixes that may be delivered by distributions.

• Thanks for confirming.

And now that we have talked about the advantages of using -system-libtiff, maybe we should also discuss the possible disadvantages? ;-)

For example, I can imagine that things do not always work as expected when using a more recent LibTIFF version than the one that comes bundled with Qt? This blog post advises against using -system-libtiff because "sometime images cannot be correctly displayed" and refers to QTBUG-11453 which is about the very similar -qt-libpng configure option.

If anyone else experienced similar problems when using their own build of LibTIFF, i would be happy to hear!

• @SGaist While looking at how we configure and build our Qt 4.8.7 right now, i see not libtiff-related configure options, which means that the default -system-libtiff is used. However, we are building on Windows and do not specify any -I or -L options. So I am wondering whether the Qt build actually finds a LibTIFF library, and if this is the case, which one is used. Any ideas on how to check that?

For the record: in our Qt-install directory, there are files like qtiff4.dll and qtiffd4.dll under plugins/imageformats/.

Or does -system-libtiff defaults to -qt-libtiff if no system libtiff is found?

• If you don't pass anything the configure script will try to use the system library and if it fails to find it fallback to its own version. If you take a look at the output of configure --help you'll see the defaults the configure script will try to use.

• @SGaist said in Which LibTIFF to use?:

If you don't pass anything the configure script will try to use the system library and if it fails to find it fallback to its own version.

I just checked this. We are not passing anything TIFF-related to the configure script, which means that we are using the default -system-libtiff. However, it looks like our system TIFF library is not found, since I noticed that the code under QT_SRC_ROOT\src\3rdparty\libtiff does gets built. I checked that by introducing a syntax error in src\3rdparty\libtiff\libtiff\tif_print.c and then noticing that our Qt build failed when compiling the 3rdparty libtiff project.

For as far as I understand it now, I will have to use -system-libtiffwith the correct -I and -L options to really make sure we are using our own build of the TIFF library. I will try that and report my findings. Stay tuned! ;-)

• Where is your system libtiff located ?

• @SGaist said in Which LibTIFF to use?:

Where is your system libtiff located ?

We are building on a Windows 7 system using VS2012 and compile LibTIFF ourselves. The header files are in D:\some\path\to\libtiff and the debug and release .lib files are in D:\some\path\to\libtiff\vc11. I assume these directories are the ones to use with the -I and -L options for -system-libtiff? (I still haven't found time to try that out, I will report later)

• Yes

AFAIK, Windows doesn't have any system libtiff.

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.