Hello,
I have a new PC on which I recently installed openSuse 12.2, it was supposed to be dual-boot but my openSuse install accidentally wiped out the Windows partition. Oh well, no big loss
Anyway, I am a developer and I have been having loads of trouble getting just about ANYTHING to compile. There seems to be a problem with ld (GNU linker) or something in the GNU toolchain. To illustrate I tried to compile a simple QT application and got the following:
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
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
g++ -m64 -Wl,-O1 -o sqlite_props main.o propertyfile.o -L/usr/lib64 -lQtCore -L/usr/lib64 -lpthread
/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)
/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)
/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)
/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)
Now libz.so.1 and the other shared object files are absolutely in my search path for ld (they are in /lib64 which /etc/ld.so.conf says is
in the path, also I tried adding -L/lib64 directly to my compile options in the Makefile, nothing works.
The other problem I have on this system is that in some cases the shared library is found, but it complains about missing symbols, but the nm command shows that the supposedly symbols are there. Perhaps these problems are related …
Thanks to anyone who can provide some guidance on this perplexing question.
lib64 is there as you can see, this is the directory containing the .so files
that ld is complaining about.
And just to be thorough.
craig@linux-9fep:~/home/craig ls /lib64/libz*
/lib64/libz.so.1 /lib64/libz.so.1.2.7
I have not set PKGCONFIG. I am not familiar with this option, but reading a bit
about it it sounds like it is meant for linking to non-Qt libraries, whereas I am
only linking to the Qt libraries. Please let me know if I misunderstood.
In the end the parts I had to add where “LIBS += -lz -ldl -lrt -lglib-2.0 -lpcre”, and the “QT += sql”. It is odd that I need to specifically link to libraries needed by QtCore. Any idea why?