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