Important: Please read the Qt Code of Conduct -

qt doesn't see zlib

  • I am trying to compile qt version 4 on an a machine running ubuntu 12.04. I get the following error messages undefined reference to
    This indicates that QT doesn't see zlib. When I tried to install zLib I got a message that it was already installed. I reinstalled it but that didn't fix the problem. QT installations must have been tested in the past so I don't understand what the problem is. I have to use qt4x with the software I'm using.

    the qt installation is qt-x11-opensoruce-src-4.0.1
    the zlib installation is from zlib_1.2.3.4.dfsg

  • @gamaliel
    Qt4 & Ubuntu 12 are quite old now. I don't know exactly why your installation shows this issue if others did not in the past. If you do not get an exact answer, however, you might want to:

    • run ldd to discover where it is looking for the missing library.
    • locate to find where yours is installed.
    • Often doing an ln -s from where it actually is to where Qt is expecting it to be will suffice for you.
    • Or, I think environment variable LD_LIBRARY_PATH is read at start up to determine where to look for shared libraries, you can alter that for your Qt app.

    There's also a way of building a zlib included with Qt4 itself (though see, though I presume you're not wanting to do that.

  • @JonB I typed ldd as you suggested. It didn't list zlib. it did list a library called => (0x00007fffe8c00000) => /usr/lib/x86_64-linux-gnu/ (0x00007f1a071f8000) => /usr/lib/x86_64-linux-gnu/ (0x00007f1a06ec0000) => /usr/lib/x86_64-linux-gnu/ (0x00007f1a069d8000) => /lib/x86_64-linux-gnu/ (0x00007f1a067b8000) => /usr/lib/x86_64-linux-gnu/ (0x00007f1a064b8000) => /lib/x86_64-linux-gnu/ (0x00007f1a061b8000) => /lib/x86_64-linux-gnu/ (0x00007f1a05fa0000) => /lib/x86_64-linux-gnu/ (0x00007f1a05be0000) => /usr/lib/x86_64-linux-gnu/ (0x00007f1a059c0000) => /lib/x86_64-linux-gnu/ (0x00007f1a057b8000) => /lib/x86_64-linux-gnu/ (0x00007f1a055a0000) => /lib/x86_64-linux-gnu/ (0x00007f1a052a8000) => /lib/x86_64-linux-gnu/ (0x00007f1a050a0000)
    /lib64/ (0x00007f1a07ae8000) => /usr/lib/x86_64-linux-gnu/ (0x00007f1a04e98000) => /usr/lib/x86_64-linux-gnu/ (0x00007f1a04c90000) => /lib/x86_64-linux-gnu/ (0x00007f1a04a50000)

  • @gamaliel => /lib/x86_64-linux-gnu/ (0x00007f1a055a0000)

    So, you tell me, that looks like it has found zlib, does it not? I do not dispute that your undefined references look like zlib functions, but there seems to be something more to your problem?

    Hmm, I wonder if there is some confusion here. I think I have been thinking about libz. I am unsure whether your zlib is the same thing, though I think it is and it's just a nomenclature issue. You should verify whether these are the same thing, and where you got the statement "This indicates that QT doesn't see zlib" from?

    The only reference I can find is

    "zlib" is the name of a Python module. "" is the runtime
    of that module. My guess is that is a shared library version of
    C "zlib" library. The Python module is essentially just a wrapper around
    the zlib library. On my linux machine ldd shows that depends on

    % ldd
   => /lib/ (0x40015000)
   => /usr/local/lib/ (0x40024000)
   => /lib/ (0x4002c000)
            /lib/ => /lib/ (0x80000000)

  • Lifetime Qt Champion


    Why not use the Qt 4 version from your distribution ?

    On a side note, as @JonB already noted, using such an outdated version is a bad idea. If locked on Qt 4, you should at least try to build the last released version which is 4.8.7.

  • @JonB I tried installing a newer 4x version of qt. I installed 4.8.4. Then I tried running openCV which uses qt. I got the error message found unsuitable QT version "" from NOTFOUND, this code requries Qt 4.x

  • Lifetime Qt Champion

    What version of OpenCV are you trying to use ?
    How did you install it ?

    Side question: in what way does that code require Qt 4 ?

  • @SGaist I had originally tried a more recent version of qt 4x which was an everywhere installation and it couldn't find the render library. So I tried an earlier version which was compiled for X11 and it didn't complain about that but couldn't find zlib. So then I tried version 4.8.4 and was able to make that. Then I tried to compile openCV and it says that it can't find qt 4x. So now I'm looking for help on opencv forums

  • Lifetime Qt Champion

    How did you install Qt 4 ?
    What version of OpenCV are you trying to use ?

    Side question: why use a 7 years old Ubuntu release ?

Log in to reply