我从以下链接安装了离线安装程序“Qt 5.8.0 for Linux 64-bit (766 MB)”以及适用于 Linux 和 Mac 用户的 tar.gz 文件:
https://www.qt.io/download-open-source/
我下载的 tar.gz 文件是qt-everywhere-opensource-src-5.8.0.tar
(我的系统是 RHEL 6.6)。
然后,我将 tar.gz 文件和安装程序都传输到了我的桌面,并开始参考此链接获取更多说明:
http://doc.qt.io/qt-5/linux-building.html
在我的桌面上,我输入了以下命令:
gunzip qt-everywhere-opensource-src-5.8.0.tar.gz
tar xvf qt-everywhere-opensource-src-5.8.0.tar
这创建了目录qt-everywhere-opensource-src-5.8.0
。然后我cd
进入该目录并输入./configure
。
这时,系统首先询问我是否需要开源版本还是商业版本,我选择了开源版本。然后系统询问我是否同意 GPL 和 LGPL 许可证,我再次选择了同意。最后系统向我显示了以下消息:
Qt is now configured for building. Just run 'gmake'.
Once everything is built, you must run 'gmake install'.
Qt will be installed into /usr/local/Qt-5.8.0
Prior to reconfiguration, make sure you remove any leftovers from
the previous build.
读完这篇文章后,我gmake
在命令行上写道。经过gmake
几个小时的处理,我得到了这些错误:
gmake[4]: Entering directory `/root/Desktop/qt-everywhere-opensource-src-5.8.0/qtscxml/examples/scxml/trafficlight-widgets-static'
/root/Desktop/qt-everywhere-opensource-src-5.8.0/qtscxml/examples/scxml/trafficlight-widgets-static/qscxmlc_wrapper.sh ../trafficlight-common/statemachine.scxml --header statemachine.h --impl ./statemachine.cpp
/root/Desktop/qt-everywhere-opensource-src-5.8.0/qtscxml/bin/qscxmlc: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by /root/Desktop/qt-everywhere-opensource-src-5.8.0/qtscxml/bin/qscxmlc)
gmake[4]: *** [statemachine.h] Error 1
gmake[4]: Leaving directory `/root/Desktop/qt-everywhere-opensource-src-5.8.0/qtscxml/examples/scxml/trafficlight-widgets-static'
gmake[3]: *** [sub-trafficlight-widgets-static-make_first] Error 2
gmake[3]: Leaving directory `/root/Desktop/qt-everywhere-opensource-src-5.8.0/qtscxml/examples/scxml'
gmake[2]: *** [sub-scxml-make_first] Error 2
gmake[2]: Leaving directory `/root/Desktop/qt-everywhere-opensource-src-5.8.0/qtscxml/examples'
gmake[1]: *** [sub-examples-make_first] Error 2
gmake[1]: Leaving directory `/root/Desktop/qt-everywhere-opensource-src-5.8.0/qtscxml'
gmake: *** [module-qtscxml-make_first] Error 2
为什么我会收到这些错误?我应该怎么做才能解决它们?
编辑:
当我输入 gcc -v 时,我得到以下输出:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/root/gcc-4.8.2/libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /root/Downloads/objdir/../gcc-4.8.2/configure --prefix=/root/gcc-4.8.2 --enable-languages=c,c++,fortran,go --disable-multilib
Thread model: posix
gcc version 4.8.2 (GCC)
我仔细阅读了错误并意识到我的错误的根源是这一行:
/root/Desktop/qt-everywhere-opensource-src-5.8.0/qtscxml/bin/qscxmlc: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by /root/Desktop/qt-everywhere-opensource-src-5.8.0/qtscxml/bin/qscxmlc)
我提到了一个Stack Overflow 答案基于此我输入了以下命令:
strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX
它给出了以下输出:
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH
显然,我的系统上没有 GLIBCXX_3.4.14,系统正在寻找它。我该如何解决这个问题?