/********************************************************************************
* libQt5Core.so: undefined reference to `dlclose@GLIBC_2.4'
* 说明:
* 在编译QT 5.8的程序的时遇到找不到库的问题。
*
* 2017-6-8 深圳 龙华樟坑村 曾剑锋
*******************************************************************************/
一、参考文档:
1. 树莓派交叉编译qt5.5的问题
http://tieba.baidu.com/p/4327053176
二、编译报错:
18:49:35: Running steps for project zengjfTest...
18:49:35: Starting: "/home/zengjf/zengjf/zengjfos/Qt5.8/rootfs/usr/local/qt5.8/bin/qmake" /home/zengjf/zengjf/zengjfos/Qt5.8Demo/zengjfTest/zengjfTest.pro -r -spec linux-arm-gnueabihf-g++
18:49:35: The process "/home/zengjf/zengjf/zengjfos/Qt5.8/rootfs/usr/local/qt5.8/bin/qmake" exited normally.
18:49:35: Starting: "/usr/bin/make"
arm-linux-gnueabihf-g++ --sysroot=/home/zengjf/zengjf/zengjfos/Qt5.8/rootfs -Wl,-O1 -Wl,-rpath,/usr/local/qt5.8/lib -o zengjfTest main.o mainwindow.o moc_mainwindow.o -L/home/zengjf/zengjf/zengjfos/Qt5.8/rootfs/usr/local/qt5.8/lib -lQt5Widgets -L/home/zengjf/zengjf/zengjfos/Qt5.8/tslib-1.4/__install/lib -lQt5Gui -lQt5Core -lpthread
/usr/lib/gcc-cross/arm-linux-gnueabihf/6/../../../../arm-linux-gnueabihf/bin/ld: warning: libdl.so.2, needed by /home/zengjf/zengjf/zengjfos/Qt5.8/rootfs/usr/local/qt5.8/lib/libQt5Core.so, not found (try using -rpath or -rpath-link)
Makefile:190: recipe for target 'zengjfTest' failed
/usr/lib/gcc-cross/arm-linux-gnueabihf/6/../../../../arm-linux-gnueabihf/bin/ld: warning: librt.so.1, needed by /home/zengjf/zengjf/zengjfos/Qt5.8/rootfs/usr/local/qt5.8/lib/libQt5Core.so, not found (try using -rpath or -rpath-link)
/home/zengjf/zengjf/zengjfos/Qt5.8/rootfs/usr/local/qt5.8/lib/libQt5Core.so: undefined reference to `clock_gettime@GLIBC_2.4'
/home/zengjf/zengjf/zengjfos/Qt5.8/rootfs/usr/local/qt5.8/lib/libQt5Core.so: undefined reference to `dlopen@GLIBC_2.4'
/home/zengjf/zengjf/zengjfos/Qt5.8/rootfs/usr/local/qt5.8/lib/libQt5Core.so: undefined reference to `dlsym@GLIBC_2.4'
/home/zengjf/zengjf/zengjfos/Qt5.8/rootfs/usr/local/qt5.8/lib/libQt5Core.so: undefined reference to `dlerror@GLIBC_2.4'
/home/zengjf/zengjf/zengjfos/Qt5.8/rootfs/usr/local/qt5.8/lib/libQt5Core.so: undefined reference to `dlclose@GLIBC_2.4'
collect2: error: ld returned 1 exit status
make: *** [zengjfTest] Error 1
18:49:35: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project zengjfTest (kit: 5.8-ARM)
When executing step "Make"
18:49:35: Elapsed time: 00:00.
18:59:40: Running steps for project zengjfTest...
18:59:40: Starting: "/home/zengjf/zengjf/zengjfos/Qt5.8/rootfs/usr/local/qt5.8/bin/qmake" /home/zengjf/zengjf/zengjfos/Qt5.8Demo/zengjfTest/zengjfTest.pro -r -spec linux-arm-gnueabihf-g++
18:59:40: The process "/home/zengjf/zengjf/zengjfos/Qt5.8/rootfs/usr/local/qt5.8/bin/qmake" exited normally.
18:59:40: Starting: "/usr/bin/make"
arm-linux-gnueabihf-g++ --sysroot=/home/zengjf/zengjf/zengjfos/Qt5.8/rootfs -Wl,-O1 -Wl,-rpath,/usr/local/qt5.8/lib -o zengjfTest main.o mainwindow.o moc_mainwindow.o -L/home/zengjf/zengjf/zengjfos/Qt5.8/rootfs/usr/local/qt5.8/lib -lQt5Widgets -L/home/zengjf/zengjf/zengjfos/Qt5.8/tslib-1.4/__install/lib -lQt5Gui -lQt5Core -lpthread
/usr/lib/gcc-cross/arm-linux-gnueabihf/6/../../../../arm-linux-gnueabihf/bin/ld: warning: libdl.so.2, needed by /home/zengjf/zengjf/zengjfos/Qt5.8/rootfs/usr/local/qt5.8/lib/libQt5Core.so, not found (try using -rpath or -rpath-link)
Makefile:190: recipe for target 'zengjfTest' failed
/usr/lib/gcc-cross/arm-linux-gnueabihf/6/../../../../arm-linux-gnueabihf/bin/ld: warning: librt.so.1, needed by /home/zengjf/zengjf/zengjfos/Qt5.8/rootfs/usr/local/qt5.8/lib/libQt5Core.so, not found (try using -rpath or -rpath-link)
/home/zengjf/zengjf/zengjfos/Qt5.8/rootfs/usr/local/qt5.8/lib/libQt5Core.so: undefined reference to `clock_gettime@GLIBC_2.4'
/home/zengjf/zengjf/zengjfos/Qt5.8/rootfs/usr/local/qt5.8/lib/libQt5Core.so: undefined reference to `dlopen@GLIBC_2.4'
/home/zengjf/zengjf/zengjfos/Qt5.8/rootfs/usr/local/qt5.8/lib/libQt5Core.so: undefined reference to `dlsym@GLIBC_2.4'
/home/zengjf/zengjf/zengjfos/Qt5.8/rootfs/usr/local/qt5.8/lib/libQt5Core.so: undefined reference to `dlerror@GLIBC_2.4'
/home/zengjf/zengjf/zengjfos/Qt5.8/rootfs/usr/local/qt5.8/lib/libQt5Core.so: undefined reference to `dlclose@GLIBC_2.4'
collect2: error: ld returned 1 exit status
make: *** [zengjfTest] Error 1
18:59:40: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project zengjfTest (kit: 5.8-ARM)
When executing step "Make"
18:59:41: Elapsed time: 00:00.
三、解决办法:
将相关的warning找不到的lib,放到对应的lib下去就可以了。