libQt5Core.so: undefined reference to `dlclose@GLIBC_2.4'

/********************************************************************************
 *       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下去就可以了。

 

时间: 2024-09-04 11:10:10

libQt5Core.so: undefined reference to `dlclose@GLIBC_2.4'的相关文章

整理linux编译link出undefined reference’dlclose’错误解决办法

对于linux我持中立态度,而且我认为linux这么多年发展比较慢的原因是因为桌面化做的不好或者不够好,所以我比较偏爱ubuntu. 由于以前项目是makefile的,我个人不是很喜欢makefile,因为他看起来比较费劲,而且编译完成后出现问题调试是个大难题,不是每个人都精通gdb,而且vi上手比较难.所以将工程转为codeblocks的cbp,本来想使用cmake的,但是觉得要写的比较多,于是作罢,毕竟代码不是跨平台的,windows下没法用. 编译完link的时候,报了一句undefine

Linux下C编程:undefined reference to ‘pthread_create'问题解决

undefined reference to 'pthread_create' undefined reference to 'pthread_join' 问题原因: pthread 库不是 Linux 系统默认的库,连接时需要使用静态库 libpthread.a,所以在使用pthread_create()创建线程,以及调用 pthread_atfork()函数建立fork处理程序时,需要链接该库. 问题解决: 在编译中要加 -lpthread参数 gcc thread.c -o thread

apache 编译报错:undefined reference to `apr_array_clear'

apache 编译报错: modules/http/.libs/libmod_http.a(byterange_filter.o): In function `ap_set_byterange': byterange_filter.c:(.text+0x1201): undefined reference to `apr_array_clear' collect2: ld returned 1 exit status make[1]: *** [httpd] Error 1 make[1]: L

解决Linux下编程时的undefined reference to问题

最近在Linux下编程发现一个诡异的现象,就是在链接一个静态库的时候总是报错,类似下面这样的错误: (.text+0x13): undefined reference to `func' 关于undefined reference这样的问题,大家其实经常会遇到,在此,我以详细地示例给出常见错误的各种原因以及解决方法,希望对初学者有所帮助. 1.链接时缺失了相关目标文件(.o) 测试代码如下: 然后编译. gcc -c test.c gcc –c main.c 得到两个 .o 文件,一个是 mai

undefined reference to `SetPduPowerConsumptionCnt''错误的解决方法

编译时出现undefined reference to `SetPduPowerConsumptionCnt'错误要如何解决呢?有没有什么好的解决方法?下面小编就为大家解答吧,如果你也遇到了这种情况,可以过来参考下   问题:程序模型用C++语言编写,在程序模型和调用函数之间添加了一个接口文件modelc.cpp,用来让用c语言程序调用程序模型中的函数: 新添加了两个函数setPduPowerConsumptionCnt()和setPduPowerConsumptionTot(),用来清除PDU

线程异常:undefined reference to 'pthread_create' 处理

源码: #include <stdio.h> #include <pthread.h> #include <sched.h> void *producter_f (void *arg); void *consumer_f (void *arg); int buffer_has_item=0; pthread_mutex_t mutex; int running =1 ; int main (void) {pthread_t consumer_t;pthread_t pr

对象-qt报错undefined reference to `vtable for btnStyle&amp;amp;#39;

问题描述 qt报错undefined reference to `vtable for btnStyle' 头文件中: //错误:undefined reference to `vtable for btnStyle' class btnStyle : public QProxyStyle { Q_OBJECT public: btnStyle(); }: 构造函数如下: //出错地方 一直报错什么问题呢,我只是对qt的例子稍微改了下,但是主体框架都没改 解决方案 问题 在一个类中添加了宏 Q_

类模板使用时遇到undefined reference to的错误

问题描述 类模板使用时遇到undefined reference to的错误 #include using namespace std; const int Max=20; template class stack { private: T s[Max]; int index; public: int getindex() { return index; } void push(T a) { s[index]=a; index ++; } T pop(){ return s[index--];

undefined reference to libiconv_open ext/iconv/.libs/iconv.o by install phpsource

错误信息:ext/iconv/.libs/iconv.o(.text+0x30e2): In function `php_iconv_stream_filter_factory_create':/home/jjdai/work/zhupiter/php-5.2.0/ext/iconv/iconv.c:2419: undefined reference to `libiconv_open'collect2: ld returned 1 exit statusmake: *** [sapi/cli/