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
    libQtGui.so 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 libQtGui.so to discover where it is looking for the missing zlib.so library.
    • locate zlib.so 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 https://stackoverflow.com/questions/10692988/static-qt-4-8-1-build-on-ubuntu-12-04), though I presume you're not wanting to do that.

  • @JonB I typed ldd libQtGui.so as you suggested. It didn't list zlib. it did list a library called libz.so.1
    linux-vdso.so.1 => (0x00007fffe8c00000)
    libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f1a071f8000)
    libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f1a06ec0000)
    libQtCore.so.4 => /usr/lib/x86_64-linux-gnu/libQtCore.so.4 (0x00007f1a069d8000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1a067b8000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f1a064b8000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1a061b8000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f1a05fa0000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1a05be0000)
    libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f1a059c0000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1a057b8000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f1a055a0000)
    libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f1a052a8000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f1a050a0000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f1a07ae8000)
    libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f1a04e98000)
    libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f1a04c90000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f1a04a50000)

  • @gamaliel

    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (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 https://mail.python.org/pipermail/python-list/2002-February/155081.html

    "zlib" is the name of a Python module. "zlib.so" is the runtime
    of that module. My guess is that libz.so 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 zlib.so depends on

    % ldd zlib.so
            libz.so.1 => /lib/libz.so.1 (0x40015000)
            libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1 (0x40024000)
            libc.so.6 => /lib/libc.so.6 (0x4002c000)
            /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (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