问小白 wenxiaobai
资讯
历史
科技
环境与自然
成长
游戏
财经
文学与艺术
美食
健康
家居
文化
情感
汽车
三农
军事
旅行
运动
教育
生活
星座命理

银河麒麟V10+ARM CPU:解决xcb编译难题

创作时间:
作者:
@小白创作中心

银河麒麟V10+ARM CPU:解决xcb编译难题

引用
CSDN
11
来源
1.
https://blog.csdn.net/weixin_44421175/article/details/139412818
2.
https://blog.csdn.net/weixin_42568710/article/details/142815914
3.
https://blog.csdn.net/xie__jin__cheng/article/details/145219435
4.
https://blog.csdn.net/u011223449/article/details/136097781
5.
https://blog.csdn.net/gitblog_09811/article/details/142939578
6.
https://blog.csdn.net/weixin_42979272/article/details/138684848
7.
https://formulae.brew.sh/
8.
https://marketplace.huaweicloud.com/contents/1be4b31e-eb4c-4fb2-b664-82379520fefc
9.
https://doc.embedfire.com/linux/rk356x/Qt/zh/latest/lubancat_qt/install/install_arm_1.html
10.
https://doc.embedfire.com/linux/rk356x/Qt/zh/latest/lubancat_qt/install/install_arm_2.html
11.
https://formulae.brew.sh/formula/python@3.13

在银河麒麟V10操作系统上使用ARM CPU编译Qt5.12.8时,经常会遇到xcb相关的编译错误。本文将详细介绍如何解决这一技术难题,帮助开发者顺利完成编译工作。

01

环境准备

银河麒麟V10操作系统基于ARM架构,这与其他常见的x86架构系统有所不同。因此,在编译Qt5.12.8之前,我们需要确保所有必要的依赖库都已正确安装。

首先,我们需要使用kylin包管理器来安装以下依赖库:

sudo apt update
sudo apt install libxcb-dev libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev

此外,我们还需要安装一些其他必要的开发工具和库:

sudo apt install build-essential libfontconfig1-dev libdbus-1-dev libfreetype6-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-xinerama0-dev libxcb-glx0-dev libx11-xcb-dev libxcb-util-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev libxcb-xinput-dev libxcb-xrandr-dev
02

依赖库安装

在安装了基本的依赖库之后,我们还需要下载并编译一些额外的库,如xcb-proto、xorgproto和Xauth。这些库通常可以通过包管理器直接安装,但在某些情况下,可能需要从源码编译。

使用包管理器安装:

sudo apt install xcb-proto xorgproto xauth

如果需要从源码编译,可以按照以下步骤操作:

  1. 下载源码包:
wget https://xcb.freedesktop.org/dist/xcb-proto-1.14.1.tar.gz
wget https://www.x.org/releases/individual/proto/xorgproto-2021.4.tar.gz
wget https://www.x.org/releases/individual/app/xauth-1.1.tar.gz
  1. 解压并编译:
tar -xf xcb-proto-1.14.1.tar.gz
cd xcb-proto-1.14.1
./configure
make
sudo make install
cd ..

tar -xf xorgproto-2021.4.tar.gz
cd xorgproto-2021.4
./configure
make
sudo make install
cd ..

tar -xf xauth-1.1.tar.gz
cd xauth-1.1
./configure
make
sudo make install
cd ..
03

xcb库编译

在安装了所有必要的依赖库之后,我们可以开始编译xcb库。首先,需要下载xcb库的源码包:

wget https://xcb.freedesktop.org/dist/libxcb-1.14.tar.gz

然后,按照以下步骤编译:

tar -xf libxcb-1.14.tar.gz
cd libxcb-1.14
./configure
make
sudo make install
cd ..
04

Qt5.12.8编译

在所有依赖库都已正确安装之后,我们可以开始编译Qt5.12.8。首先,需要下载Qt5.12.8的源码包:

wget https://download.qt.io/new_archive/qt/5.12/5.12.8/single/qt-everywhere-src-5.12.8.tar.xz

然后,按照以下步骤编译:

sudo tar -xf qt-everywhere-src-5.12.8.tar.xz
cd qt-everywhere-src-5.12.8

由于配置参数较多,建议创建一个自动配置脚本:

sudo touch auto.sh
sudo chmod 755 auto.sh
sudo vim auto.sh

在auto.sh中添加以下内容:

./configure -prefix /root/qt-5.12.8 \
-opensource \
-confirm-license \
-release \
-strip \
-shared \
-optimized-qmake \
-c++std c++11 \
--rpath=no \
-pch \
-webengine-proprietary-codecs \
-skip qt3d \
-skip qtactiveqt \
-skip qtandroidextras \
-skip qtcanvas3d \
-skip qtconnectivity \
-skip qtdatavis3d \
-skip qtdoc \
-skip qtgamepad \
-skip qtlocation \
-skip qtmacextras \
-skip qtnetworkauth \
-skip qtpurchasing \
-skip qtremoteobjects \
-skip qtscript \
-skip qtscxml \
-skip qtsensors \
-skip qtspeech \
-skip qtsvg \
-skip qttools \
-skip qttranslations \
-skip qtwayland \
-skip qtwinextras \
-skip qtx11extras \
-skip qtxmlpatterns \
-skip qtgraphicaleffects \
-make libs \
-nomake tools \
-nomake tests \
-gui \
-widgets \
-dbus-runtime \
--glib=no \
--iconv=no \
--pcre=qt \
-qt-zlib \
-no-vulkan \
-no-openssl \
--freetype=qt \
--harfbuzz=qt \
-opengl es2 \
-xcb \
-xcb-xlib \
-egl \
-eglfs \
--pcre=qt \
-linuxfb \
-no-tslib \
-qt-libpng \
-qt-libjpeg \
--sqlite=qt

运行auto.sh脚本进行配置:

sh auto.sh

配置完成后,开始编译:

make
sudo make install
05

常见问题及解决方案

在编译过程中,可能会遇到以下问题:

  1. 缺少依赖库:如果configure阶段报错,提示缺少某个库,需要确保所有依赖库都已正确安装。可以使用pkg-config检查库是否可用:
pkg-config --list-all | grep <库名>
  1. 环境变量问题:如果编译时找不到库文件,需要检查PKG_CONFIG_PATHLD_LIBRARY_PATH环境变量是否正确设置:
export PKG_CONFIG_PATH=/path/to/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/path/to/lib:$LD_LIBRARY_PATH
  1. 版本不兼容:如果遇到版本不兼容的问题,需要确保所有依赖库的版本都与Qt5.12.8的要求相匹配。可以查看Qt的官方文档获取具体的版本要求。

通过以上步骤,应该能够解决在银河麒麟V10操作系统上使用ARM CPU编译Qt5.12.8时遇到的xcb相关问题。如果仍然遇到问题,建议查看Qt的官方文档或在相关的开发者论坛寻求帮助。

© 2023 北京元石科技有限公司 ◎ 京公网安备 11010802042949号