Results 1 to 12 of 12

Thread: Linker warning: libz.so.1 not found

  1. #1
    Join Date
    Jan 2006
    Posts
    8
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Linker warning: libz.so.1 not found

    Hello,
    I am attempting to write a small console app in QtCreator on openSuse Linux 12.2 (using the version provided by the distro 2.5.0). The application simply
    connects to a small SQLite database and reads some data from a table.

    Compiling works fine, but when it tries to link I get errors along the following lines:


    Qt Code:
    1. /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: libz.so.1, needed by /usr/lib64/libQtCore.so, not found (try using -rpath or -rpath-link)
    2. /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: libdl.so.2, needed by /usr/lib64/libQtCore.so, not found (try using -rpath or -rpath-link)
    3. /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: librt.so.1, needed by /usr/lib64/libQtCore.so, not found (try using -rpath or -rpath-link)
    4. /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: libglib-2.0.so.0, needed by /usr/lib64/libQtCore.so, not found (try using -rpath or -rpath-link)
    To copy to clipboard, switch view to plain text mode 


    All the libraries that ld reports as missing are installed and in my ld path. For example:

    Qt Code:
    1. > ls /lib64/libz*
    2. /lib64/libz.so.1 /lib64/libz.so.1.2.7
    To copy to clipboard, switch view to plain text mode 

    According to ldconfig /lib64 is in the ld search path. The contents of ld.so.conf are:

    Qt Code:
    1. usr/local/lib64
    2. /usr/local/lib
    3. include /etc/ld.so.conf.d/*.conf
    4. # /lib64, /lib, /usr/lib64 and /usr/lib gets added
    5. # automatically by ldconfig after parsing this file.
    6. # So, they do not need to be listed.
    To copy to clipboard, switch view to plain text mode 


    Thanks for any ideas on what the problem might be.

    Cheers,

    Craig

    PS. I don't expect an answer to this as it is a bit OT, but since I was curious - does anyone know why the convoluted search path to call ld, and not just /usr/x86_64-suse-linux/bin/ld? This isn't a Qt issue, but seems to be the way the gcc toolchain is setup on openSuse.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Linker warning: libz.so.1 not found

    Quote Originally Posted by CraigD View Post
    Qt Code:
    1. /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: libz.so.1, needed by /usr/lib64/libQtCore.so, not found (try using -rpath or -rpath-link)
    2. /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: libdl.so.2, needed by /usr/lib64/libQtCore.so, not found (try using -rpath or -rpath-link)
    3. /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: librt.so.1, needed by /usr/lib64/libQtCore.so, not found (try using -rpath or -rpath-link)
    4. /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: libglib-2.0.so.0, needed by /usr/lib64/libQtCore.so, not found (try using -rpath or -rpath-link)
    To copy to clipboard, switch view to plain text mode 


    All the libraries that ld reports as missing are installed and in my ld path. For example:

    Qt Code:
    1. > ls /lib64/libz*
    2. /lib64/libz.so.1 /lib64/libz.so.1.2.7
    To copy to clipboard, switch view to plain text mode 

    According to ldconfig /lib64 is in the ld search path. The contents of ld.so.conf are:

    Qt Code:
    1. usr/local/lib64
    2. /usr/local/lib
    3. include /etc/ld.so.conf.d/*.conf
    4. # /lib64, /lib, /usr/lib64 and /usr/lib gets added
    5. # automatically by ldconfig after parsing this file.
    6. # So, they do not need to be listed.
    To copy to clipboard, switch view to plain text mode 
    Run ldd on those libs that report missing symbols (e.g. /usr/lib64/libQtCore.so) and see if the linker is able to find your libz and others.

    PS. I don't expect an answer to this as it is a bit OT, but since I was curious - does anyone know why the convoluted search path to call ld, and not just /usr/x86_64-suse-linux/bin/ld? This isn't a Qt issue, but seems to be the way the gcc toolchain is setup on openSuse.
    Because you might have more than one set of binutils installed on your machine and the build process wants to make sure it calls the right one (through the use of symbolic links).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    CraigD (3rd October 2012)

  4. #3
    Join Date
    Jan 2006
    Posts
    8
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Linker warning: libz.so.1 not found

    Quote Originally Posted by wysota View Post
    Run ldd on those libs that report missing symbols (e.g. /usr/lib64/libQtCore.so) and see if the linker is able to find your libz and others.
    From running ldd I get the following.

    Everything seems to be there (I checked and libQtCore.so is a symlink to libQtCore.so.4.8.1).

    Qt Code:
    1. ldd libQtCore.so.4.8.1
    2. linux-vdso.so.1 (0x00007fff0b400000)
    3. libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f045ece8000)
    4. libz.so.1 => /lib64/libz.so.1 (0x00007f045ead0000)
    5. libdl.so.2 => /lib64/libdl.so.2 (0x00007f045e8c8000)
    6. librt.so.1 => /lib64/librt.so.1 (0x00007f045e6c0000)
    7. libglib-2.0.so.0 => /usr/lib64/libglib-2.0.so.0 (0x00007f045e3c8000)
    8. libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f045e0c0000)
    9. libm.so.6 => /lib64/libm.so.6 (0x00007f045ddc8000)
    10. libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f045dbb0000)
    11. libc.so.6 => /lib64/libc.so.6 (0x00007f045d808000)
    12. /lib64/ld-linux-x86-64.so.2 (0x00007f045ef08000)
    13. libpcre.so.1 => /usr/lib64/libpcre.so.1 (0x00007f045d5a8000)
    To copy to clipboard, switch view to plain text mode 

    Do you see anything fishy there?

    Cheers,
    Craig

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Linker warning: libz.so.1 not found

    Does the compilation work if you do it from the command line and not from QtCreator?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #5
    Join Date
    Jan 2006
    Posts
    8
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Linker warning: libz.so.1 not found

    Quote Originally Posted by wysota View Post
    Does the compilation work if you do it from the command line and not from QtCreator?
    I went to the project directory and did the following:

    Qt Code:
    1. >qmake sqlite_props.pro
    2. >gmake
    To copy to clipboard, switch view to plain text mode 

    It spits out the following (main.cpp and propertyfile.cpp are the two source files for my project):

    Qt Code:
    1. g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/default -I. -I/usr/include/QtCore -I/usr/include -I. -o main.o main.cpp
    2. g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/default -I. -I/usr/include/QtCore -I/usr/include -I. -o propertyfile.o propertyfile.cpp
    3. g++ -m64 -Wl,-O1 -o sqlite_props main.o propertyfile.o -L/usr/lib64 -lQtCore -L/usr/lib64 -lpthread
    4. /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: libz.so.1, needed by /usr/lib64/libQtCore.so, not found (try using -rpath or -rpath-link)
    5. /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: libdl.so.2, needed by /usr/lib64/libQtCore.so, not found (try using -rpath or -rpath-link)
    6. /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: librt.so.1, needed by /usr/lib64/libQtCore.so, not found (try using -rpath or -rpath-link)
    7. /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: libglib-2.0.so.0, needed by /usr/lib64/libQtCore.so, not found (try using -rpath or -rpath-link)
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    Craig

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Linker warning: libz.so.1 not found

    Does it work if you add the following entry to the project file?

    qmake Code:
    1. LIBS += -L/lib64
    To copy to clipboard, switch view to plain text mode 

    By the way, how did you install Qt?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #7
    Join Date
    Jan 2006
    Posts
    8
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Linker warning: libz.so.1 not found

    Quote Originally Posted by wysota View Post
    Does it work if you add the following entry to the project file?

    qmake Code:
    1. LIBS += -L/lib64
    To copy to clipboard, switch view to plain text mode 

    By the way, how did you install Qt?
    Adding the LIBS to the project file did not change any of the error messages.

    I installed the libraries included with the distro (openSuse 12.2 ) through Yast.

    Checking through my list of installed packages I noticed that I have both libqt4 and libqt4-32bit installed, could this be part of the problem?

    Cheers,

    Craig

  9. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Linker warning: libz.so.1 not found

    Quote Originally Posted by CraigD View Post
    I installed the libraries included with the distro (openSuse 12.2 ) through Yast.
    If you use standard repositories and this is happening then I suggest looking if anyone else with openSuse 12.2 had a similar problem. It seems like an issue with distro packages.

    Checking through my list of installed packages I noticed that I have both libqt4 and libqt4-32bit installed, could this be part of the problem?
    I don't think so. The messages clearly indicate you are using 64b libs.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  10. The following user says thank you to wysota for this useful post:

    CraigD (3rd October 2012)

  11. #9
    Join Date
    Jan 2006
    Posts
    8
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Linker warning: libz.so.1 not found

    Thanks. I am taking my troubles to the openSuse forums.

    If I can find out what went wrong I will post here for the education of future generations ...

    Cheers,
    Craig

  12. #10
    Join Date
    Jan 2006
    Posts
    8
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Linker warning: libz.so.1 not found

    With some help on the openSuse form. I seem to have found a solution to my problem, but it looks like it was my mis-use of QtCreator that was the problem.

    I added the following lines to my .pro file, after which a call to qmake and gmake did the trick.

    Qt Code:
    1. QT += sql
    2. LIBS += -lz -ldl -lrt -lglib-2.0 -lpcre
    To copy to clipboard, switch view to plain text mode 

    I am surprised I had to explicitly add the -lz -ldl -lrt -lglib-2.0 -lpcre to my .pro file.

    Can anyone explain why it is necessary to specifically link to these libraries which are already in the path.

    Perhaps the fact that I didn't initially specify QT += sql caused this.

    Anyway, hope this helps if anyone else stumbles across the same problem in the future.

    Cheers,

    Craig

  13. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Linker warning: libz.so.1 not found

    Quote Originally Posted by CraigD View Post
    I am surprised I had to explicitly add the -lz -ldl -lrt -lglib-2.0 -lpcre to my .pro file.
    You shouldn't need to do that unless you are using static libraries.

    Can anyone explain why it is necessary to specifically link to these libraries which are already in the path.
    It's not necessary.

    Perhaps the fact that I didn't initially specify QT += sql caused this.
    That's very unlikely.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  14. #12
    Join Date
    Jan 2013
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Linker warning: libz.so.1 not found

    Hello Craig,

    I ran exactly into the same problem like you and like you I use openSUSE 12.2. But I do not try to build Qt software, I tried to build the media center software XBMC. I get the same errors like you, the linker cannot find libraried, although they are installed on the system.

    I get errors like this:

    Qt Code:
    1. /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld:
    2. warning: libm.so.6, needed by /usr/lib64/libpython2.7.so, not found (try
    3. using -rpath or -rpath-link)
    To copy to clipboard, switch view to plain text mode 

    Actually libm.so.6 is there. My guess was the linker in openSUSE is broken. But, the amazing thing is, other folks can build XBMC on openSUSE 12.2, so it leaves me totally clueless.

    What would I have to do to adapt your solution to my problem? Actually it seems we have the very same problem, only difference you build Qt code and I try to build XBMC.

    addendum
    I have now removed all binutil packages that I do not need, e.g. for ARM, IA64 and so on, I only kept binutils for x86_64 and i386 and suddenly I can build the software now! Can this really be the root of the problem? Does having several binutils on the system make the system weird? All I can say it works now, all I did was to remove unneeded binutils.

    Thanx
    Malte
    Last edited by pinguin74; 26th January 2013 at 00:45.

Similar Threads

  1. Replies: 2
    Last Post: 16th November 2011, 21:26
  2. Warning: No relevant classes found?
    By zgulser in forum Qt Programming
    Replies: 5
    Last Post: 30th September 2010, 00:42
  3. warning
    By mickey in forum Newbie
    Replies: 5
    Last Post: 26th September 2006, 23:38
  4. warning
    By mickey in forum General Programming
    Replies: 1
    Last Post: 20th July 2006, 13:22
  5. Re: Problems using DLL & .so libz
    By yabadabadoo in forum Qt Programming
    Replies: 1
    Last Post: 15th July 2006, 13:02

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.