Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Including libtiff.pri gets error "Could not find feature system-zlib"



  • Dear All,

    I'm using Qt 5.9.3 on Windows, and trying to use LibTiff by including "3rdparty/libtiff.pri" in my .pro file.

    # MyProject.pro
    include($$(QTDIR)/../Src/qtimageformats/src/3rdparty/libtiff.pri)
    

    It was possible to use LibTiff by this way in Qt 5.7.0.
    However in Qt 5.9.3, qmake gets "Could not find feature system-zlib" error.

    "libtiff.pri" includes "zlib_dependency.pri", and it seems "zlib_dependency.pri" causes the error.

    #libtiff.pri
    INCLUDEPATH += $$PWD/libtiff/libtiff
    SOURCES += \
        $$PWD/libtiff/libtiff/tif_aux.c \
        ...
        $$PWD/libtiff/port/snprintf.c
    
    win32:        SOURCES += $$PWD/libtiff/libtiff/tif_win32.c
    else:         SOURCES += $$PWD/libtiff/libtiff/tif_unix.c
    android:      SOURCES += $$PWD/libtiff/port/lfind.c
    
    include($$PWD/zlib_dependency.pri)
    
    # zlib_dependency.pri
    qtConfig(system-zlib) {
        QMAKE_USE_PRIVATE += zlib
    } else {
        QT_PRIVATE += zlib-private
    }
    

    Has anyone know how to solve this problem?



  • @aibo said in including libtiff.pri gets error "Could not find feature system-zlib":

    qtConfig(system-zlib) {

    IMO it's telling you that Qt will use system provided zlib. So you need to install zlib in your OS. More information about Qt configuration options here.



  • This post is deleted!


  • @Pablo-J.-Rogina

    Thank you for your suggestion, but it seems I need to build Qt source code with -system-zlib option.
    For many various reasons, I would like to use prebuilt Qt binaries...

    The only solution I found is to modify "zlib_dependency.pri" like this.

    #qtConfig(system-zlib) {
    contains(QT_CONFIG, system-zlib) { // same as Qt 5.7.0's zlib_dependency.pri
    QMAKE_USE_PRIVATE += zlib
    } else {
    QT_PRIVATE += zlib-private
    }
    

    Qt 5.7.0 used "contains" instead of "qtConfig", and it worked fine.
    By modifying Qt 5.9.3's zlib_dependency.pri in the same way, the error has been disappeared.
    But if you know other better solutions, let me know please.


Log in to reply