【问题标题】:Failed to install QtCore4 on Ubuntu 16.10, perl version 5.24.1在 Ubuntu 16.10、perl 版本 5.24.1 上安装 QtCore4 失败
【发布时间】:2017-08-28 17:39:10
【问题描述】:

我正在尝试在 Ubuntu 16.10、perl 版本 5.24.1 上安装 QtCore4

sudo apt-get install cmake
sudo apt-get install qt4-designer libqtgui4-perl
cpan -g QtCore4
bunzip2 Qt4-0.99.0.tar.bz2
tar xvf Qt4-0.99.0.tar
cd Qt4-0.99.0
perl Makefile.PL
make VERBOSE=1

这里make 失败并显示错误消息:

Building CXX object smokeqt/qtdbus/CMakeFiles/smokeqtdbus.dir/x_1.cpp.o

cd /home/hakon/Qt4-0.99.0/smokeqt/qtdbus
/usr/bin/c++   -DSMOKE_BUILDING -Dsmokeqtdbus_EXPORTS \
 -I/usr/include/qt4/QtDesigner \
 -I/usr/include/qt4/QtDeclarative \
 -I/usr/include/qt4/QtScriptTools \
 -I/usr/include/qt4/QtDBus \
 -I/usr/include/qt4/QtXml \
 -I/usr/include/qt4/QtSql \
 -I/usr/include/qt4/QtOpenGL \
 -I/usr/include/qt4/QtNetwork \
 -I/usr/include/qt4/QtXmlPatterns \
 -I/usr/include/qt4/QtHelp \
 -I/usr/include/qt4/QtUiTools \
 -I/usr/include/qt4/QtTest \
 -I/usr/include/qt4/QtScript \
 -I/usr/include/qt4/QtSvg \
 -I/usr/include/qt4/Qt3Support \
 -I/usr/include/qt4/QtGui \
 -I/usr/include/qt4/QtCore \
 -I/usr/share/qt4/mkspecs/default \
 -I/usr/include/qt4 \
 -I/home/hakon/Qt4-0.99.0/src \
 -I/home/hakon/Qt4-0.99.0/smokeqt \
 -I/home/hakon/Qt4-0.99.0/smokegen \
 -I/home/hakon/Qt4-0.99.0/smokeqt/qtdbus \
 -I/home/hakon/Qt4-0.99.0/smoke \
 -I/home/hakon/Qt4-0.99.0/smoke/qtdbus  \
 -O3 -DNDEBUG -fPIC   -o CMakeFiles/smokeqtdbus.dir/x_1.cpp.o \
 -c /home/hakon/Qt4-0.99.0/smokeqt/qtdbus/x_1.cpp

/home/hakon/Qt4-0.99.0/smokeqt/qtdbus/x_1.cpp:1594:7: error: deleted function ‘virtual __smokeqtdbus::x_QDBusConnectionInterface::~x_QDBusConnectionInterface()’
 class x_QDBusConnectionInterface : public QDBusConnectionInterface {
       ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/qt4/QtDBus/QtDBus:8:0,
                 from /home/hakon/Qt4-0.99.0/smokeqt/qtdbus/qtdbus_includes.h:2,
                 from /home/hakon/Qt4-0.99.0/smokeqt/qtdbus/x_1.cpp:2:
/usr/include/qt4/QtDBus/qdbusconnectioninterface.h:73:5: error: overriding non-deleted function ‘virtual QDBusConnectionInterface::~QDBusConnectionInterface()’
     ~QDBusConnectionInterface();
     ^
/home/hakon/Qt4-0.99.0/smokeqt/qtdbus/x_1.cpp:1594:7: note: ‘virtual __smokeqtdbus::x_QDBusConnectionInterface::~x_QDBusConnectionInterface()’ is implicitly deleted because the default definition would be ill-formed:
 class x_QDBusConnectionInterface : public QDBusConnectionInterface {
       ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/hakon/Qt4-0.99.0/smokeqt/qtdbus/x_1.cpp:1594:7: error: ‘virtual QDBusConnectionInterface::~QDBusConnectionInterface()’ is private within this context

这些线程可能是相关的:

【问题讨论】:

    标签: c++ qt perl


    【解决方案1】:

    似乎派生类x_QDBusConnectionInterface中缺少析构函数:

    /home/hakon/Qt4-0.99.0/smokeqt/qtdbus/x_1.cpp:1594:7: 注意:‘虚拟 __smokeqtdbus::x_QDBusConnectionInterface::~x_QDBusConnectionInterface()’ 被隐式删除,因为默认定义是 格式错误:

    通过在/home/hakon/Qt4-0.99.0/smokeqt/qtdbus/x_1.cpp 的第 1595 行插入默认析构函数:

    ~x_QDBusConnectionInterface();
    

    错误消失了。但是,其他三个文件现在也有这个丢失的析构函数错误:

    • /home/hakon/Qt4-0.99.0/smokeqt/qtgui/x_3.cpp:4024

    • /home/hakon/Qt4-0.99.0/smokeqt/qtgui/x_13.cpp:3572

    • /home/hakon/Qt4-0.99.0/smokeqt/qthelp/x_1.cpp:873

    以与第一个相同的方式修复这些错误,仍然出现一个新错误:

    /home/hakon/Qt4-0.99.0/qtcore/src/util.cpp: In function ‘void
    XS_AUTOLOAD(CV*)’: /home/hakon/Qt4-0.99.0/qtcore/src/util.cpp:2234:59:
    error: cannot convert ‘bool’ to ‘void*’ in initialization    
         static smokeperl_object nothis = { 0, 0, 0, false };
                                                           ^
    

    smokeperl_object 的定义在第 9 行的/home/hakon/Qt4-0.99.0/qtcore/src/smokeperl.h 中给出:

    struct smokeperl_object {
        bool allocated;
        Smoke* smoke;
        int classId;
        void* ptr;
    };
    

    根据这个定义,用0 替换/home/hakon/Qt4-0.99.0/qtcore/src/util.cpp:2234false 似乎是一个不错的尝试:

    static smokeperl_object nothis = { 0, 0, 0, 0 };
    

    没有重新编译修复了这个错误,但是发现了一个链接器错误:

    /usr/bin/c++  -fPIC -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong \
     -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG  \
     -shared -Wl,-soname,QtCore4.so -o ../../blib/arch/auto/QtCore4/QtCore4.so \
     CMakeFiles/perlqtcore4.dir/binding.cpp.o \
     CMakeFiles/perlqtcore4.dir/handlers.cpp.o \
     CMakeFiles/perlqtcore4.dir/marshall_types.cpp.o \
     CMakeFiles/perlqtcore4.dir/util.cpp.o \
     CMakeFiles/perlqtcore4.dir/QtCore4.c.o \
     -lQtCore -lQtGui -lQtNetwork \
     /home/hakon/perlbrew/perls/perl-5.24.1/lib/5.24.1/x86_64-linux/CORE/libperl.a \
     ../../smokeqt/qtgui/libsmokeqtgui.so.3.0.0 \
     ../../smokeqt/qtnetwork/libsmokeqtnetwork.so.3.0.0 \
     -lpthread -lnsl -ldl -lm -lcrypt -lutil -lc -lQtGui -lQtNetwork \
     ../../smokeqt/qtcore/libsmokeqtcore.so.3.0.0 -lQtCore \
     ../../smokegen/bin/libsmokebase.so.3.0.0 \
     -Wl,-rpath,/home/hakon/Qt4-0.99.0/smokeqt/qtgui:/home/hakon/Qt4-0.99.0/smokeqt/qtnetwork:/home/hakon/Qt4-0.99.0/smokeqt/qtcore:/home/hakon/Qt4-0.99.0/smokegen/bin: 
    
    /usr/bin/ld: /home/hakon/perlbrew/perls/perl-5.24.1/lib/5.24.1/x86_64-linux/CORE/libperl.a(toke.o): 
      relocation R_X86_64_PC32 against symbol `PL_curcop' can not be used when making
      a shared object; recompile with -fPIC
    /usr/bin/ld: final link failed: Bad value
    collect2: error: ld returned 1 exit status
    

    我仍然不确定如何修复最后一个错误..

    【讨论】:

    • 使用 -fPIC 重新编译(如编译器建议的那样)是否有助于解决新问题?
    • @hlt 我认为它需要使用-fPIC 标志重新编译libperl.a 中的目标文件。我不确定如何执行此操作,请参阅this 问题。
    • 已添加cpan bug report
    猜你喜欢
    • 2017-03-17
    • 2017-02-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-30
    • 2015-10-28
    • 1970-01-01
    相关资源
    最近更新 更多