步骤:
tar xf qt-everywhere-opensource-src-5.15.3.tar
cd qt-everywhere-src-5.15.3/
./configure --prefix=/home/install/qt-5.15.3??-opensource??-shared??-static??-compile-examples??-xcb
time make -j 8
time make install -j 8
问题1:
Feature 'xcb' was enabled, but the pre-condition 'features.thread??&& libs.xcb && tests.xcb_syslibs && features.xkbcommon-x11' failed.
现象:
(base) [lzc@localhost qt-everywhere-src-5.15.3]$ ./configure??--prefix=/home/install/qt-5.15.3??-opensource??-shared??-static???-compile-examples -xcb
+ cd qtbase
+??/home/data/lzc/technic/coding/lang/qt/release/5.15.3/qt-everywhere-src-5.15.3/qtbase/configure -top-level --prefix=/home/install/qt-5.15.3??-opensource -shared -static -compile-examples -xcb
Creating qmake...
.Done.
...
Note: The following modules are not being compiled in this??configuration:
????webenginecore
????webengine
????webenginewidgets
????pdf
????pdfwidgets
WARNING: QDoc will not be compiled, probably because libclang could not??be located. This means that you cannot build the Qt documentation.
Either ensure that llvm-config is in your PATH environment variable, or??set LLVM_INSTALL_DIR to the location of your llvm installation.
On Linux systems, you may be able to install libclang by installing the??libclang-dev or libclang-devel package, depending on your distribution.
On macOS, you can use Homebrew's llvm package.
On Windows, you must set LLVM_INSTALL_DIR to the installation path.
WARNING: Tool gperf is required to build QtWebEngine.
WARNING: Tool gperf is required to build QtPdf.
WARNING: QtWebEngine will not be built.
WARNING: QtPdf will not be built.
ERROR: Feature 'xcb' was enabled, but the pre-condition 'features.thread??&& libs.xcb && tests.xcb_syslibs && features.xkbcommon-x11' failed.
Check config.log for details.
网上有很多这类解决方法,总体思路是安装缺失xcb库,这些库需要覆盖:
libfontconfig1-dev
libfreetype6-dev
libx11-dev
libx11-xcb-dev
libxext-dev
libxfixes-dev
libxi-dev
libxrender-dev
libxcb1-dev
libxcb-glx0-dev
libxcb-keysyms1-dev
libxcb-image0-dev
libxcb-shm0-dev
libxcb-icccm4-dev
libxcb-sync0-dev
libxcb-xfixes0-dev
libxcb-shape0-dev
libxcb-randr0-dev
libxcb-render-util0-dev
libxcd-xinerama-dev
libxkbcommon-dev
libxkbcommon-x11-dev
但是在我的centos8上这些库用yum list查看都是安装好的,或者yum reinstall重新安装都解决不了问题。
最后通过分析config.log发现提示是xcb_icccm库not foud:
/usr/bin/pkg-config --modversion xcb-icccm '>=' 0.3.9
not found
但事实上这个库在系统里面已经是安装的:
(base) [root@localhost qt-everywhere-src-5.15.3]# ll /lib64/libxcb-icccm.*
-rw-r--r--. 1 root root 87378 Apr??5 11:36 /lib64/libxcb-icccm.a
-rwxr-xr-x. 1 root root???975 Apr??5 11:36 /lib64/libxcb-icccm.la
lrwxrwxrwx. 1 root root????21 Apr??5 11:36 /lib64/libxcb-icccm.so -> libxcb-icccm.so.4.0.0
lrwxrwxrwx. 1 root root????21 Apr??5 11:36 /lib64/libxcb-icccm.so.4 -> libxcb-icccm.so.4.0.0
-rwxr-xr-x. 1 root root 56360 Apr??5 11:36 /lib64/libxcb-icccm.so.4.0.0
config.log里面所谓的找不到是pkt-config找不到,那为什么xcb却能找到:
+ /usr/bin/pkg-config --modversion xcb '>=' 1.11
> 1.13.1
pkt-config找库的原理是通过识别一类后缀名“pc”的文件来实现的,比如“ xcb-renderutil.pc”,这些问题一般放在如下目录里面:
/lib64/pkgconfig/
/usr/lib64/pkgconfig/
也即是说libxcb-icccm的.pc文件没有被pkt-config找到而xcb却能够被找到,进而发现,在/lib64/pkgconfig/下面没有xcb-icccm.pc文件。
解决方法:
到这个网址去下载对应的rqm文件安装,
或者到这个网址去下载源码安装,安装路径为 --prefix=/usr
潜在风险是可能面临依赖问题。
解决libxcb-icccm问题后,陆续发现还存在以及库找不到情况,特别是libxkbcommon-x11以来比较多,没法继续:
xcb-util-renderutil
xcb-util-keysyms
xcb-util-image
libxkbcommon-x11
也就是说
libxkbcommon-x11必须由yum install来安装。
在对应的页面上:
有如下提示:
Install Howto
Install?libxkbcommon-x11-devel rpm package:# dnf --enablerepo=powertools install libxkbcommon-x11-devel
找一个yum/dnf 国内源,使用dnf安装解决问题。
问题2:
/home/data/lzc/technic/coding/lang/qt/release/5.15.3/qt-everywhere-src-5.15.3/qtbase/src/corelib/text/qbytearraymatcher.h:103:38: error: ‘numeric_limits’ is not a member of ‘std’
??103 |?????????const auto uchar_max = (std::numeric_limits<uchar>::max)();
??????|??????????????????????????????????????^~~~~~~~~~~~~~
/home/data/lzc/technic/coding/lang/qt/release/5.15.3/qt-everywhere-src-5.15.3/qtbase/src/corelib/text/qbytearraymatcher.h:103:58: error: expected primary-expression before
‘>’ token
??103 |?????????const auto uchar_max = (std::numeric_limits<uchar>::max)();
??????|??????????????????????????????????????????????????????????^
/home/data/lzc/technic/coding/lang/qt/release/5.15.3/qt-everywhere-src-5.15.3/qtbase/src/corelib/text/qbytearraymatcher.h:103:61: error: ‘::max’ has not been declared; did you mean ‘std::max’?
??103 |?????????const auto uchar_max = (std::numeric_limits<uchar>::max)();
??????|?????????????????????????????????????????????????????????????^~~
??????|?????????????????????????????????????????????????????????????std::max
In file included from qqmlprofilerevent.cpp:40:
qqmlprofilerevent_p.h: In member function ‘void QQmlProfilerEvent::assignNumbers(const Container&)’:
qqmlprofilerevent_p.h:314:65: error: ‘numeric_limits’ is not a member of ‘std’
??314 |?????????????????????static_cast<quint16>(numbers.size()) : std::numeric_limits<quint16>::max();
??????|?????????????????????????????????????????????????????????????????^~~~~~~~~~~~~~
qqmlprofilerevent_p.h:314:87: error: expected primary-expression before ‘>’ token
??314 |?????????????????????static_cast<quint16>(numbers.size()) : std::numeric_limits<quint16>::max();
??????|???????????????????????????????????????????????????????????????????????????????????????^
qqmlprofilerevent_p.h:314:90: error: ‘::max’ has not been declared; did you mean ‘std::max’?
??314 |?????????????????????static_cast<quint16>(numbers.size()) : std::numeric_limits<quint16>::max();
??????|??????????????????????????????????????????????????????????????????????????????????????????^~~
??????|??????????????????????????????????????????????????????????????????????????????????????????std::max
In file included from /home/install/gcc-11.2.0/include/c++/11.2.0/algorithm:62,
解决方法:
找到对应的头文件,添加标准库:
|