【ARM开发】交叉编译Qt源码之(4)添加xcb支持

article/2025/8/20 22:58:38

Debian 9

1、依赖

Qt源码添加xcb支持,依赖xcb-util-wm、xcb-util、xcb-util-image、xcb-util-keysyms、xcb-util-renderutil、libxkbcommon、libxkbcommon-x11,其中libxkbcommon依赖xkeyboard-config、libxml,libxml依赖zlib、xz-utils。

1.1、xcb-util-wm

下载地址:Index of /releases/individual/xcbhttps://www.x.org/releases/individual/xcb/

#解压
tar -zxvf xcb-util-wm-0.4.1.tar.gz
cd xcb-util-wm-0.4.1
#交叉编译环境,其中/path/to/cross-compile指交叉编译器目录
#如/home/user/toolchain/arm-linux-gnueabihf/bin
export PATH=$PATH:/path/to/cross-compile
#配置,其中/path/to/prefix指编译安装目录
#如/home/user/toolchain/arm-linux-gnueabihf/arm-linux-gnueabihf
#把编译结果安装在交叉编译器中,否则引用到该库需要指定对应的目录
./configure --prefix=/path/to/prefix \
--host=arm-linux-gnueabihf \
--enable-option-checking
#编译
make
#安装
make install

1.2、xcb-util

        下载地址:Index of /releases/individual/xcbhttps://www.x.org/releases/individual/xcb/

#解压
tar -zxvf tar -zxvf xcb-util-0.4.0.tar.gz
cd xcb-util-0.4.0
#交叉编译环境,其中/path/to/cross-compile指交叉编译器目录
#如/home/user/toolchain/arm-linux-gnueabihf/bin
export PATH=$PATH:/path/to/cross-compile
#配置,其中/path/to/prefix指编译安装目录
#如/home/user/toolchain/arm-linux-gnueabihf/arm-linux-gnueabihf
#把编译结果安装在交叉编译器中,否则引用到该库需要指定对应的目录
./configure --prefix=/path/to/prefix \
--host=arm-linux-gnueabihf \
--enable-option-checking
#编译
make
#安装
make install

1.3、xcb-util-image

  下载地址:Index of /releases/individual/xcbhttps://www.x.org/releases/individual/xcb/

#解压
tar -zxvf xcb-util-image-0.4.0.tar.gz
cd xcb-util-image-0.4.0
#交叉编译环境,其中/path/to/cross-compile指交叉编译器目录
#如/home/user/toolchain/arm-linux-gnueabihf/bin
export PATH=$PATH:/path/to/cross-compile
#配置,其中/path/to/prefix指编译安装目录
#如/home/user/toolchain/arm-linux-gnueabihf/arm-linux-gnueabihf
#把编译结果安装在交叉编译器中,否则引用到该库需要指定对应的目录
./configure --prefix=/path/to/prefix \
--host=arm-linux-gnueabihf \
--enable-option-checking
#编译
make
#安装
make install

 1.4、xcb-util-keysyms

  下载地址:Index of /releases/individual/xcbhttps://www.x.org/releases/individual/xcb/

#解压
tar -zxvf xcb-util-keysyms-0.4.0.tar.gz
cd xcb-util-keysyms-0.4.0
#交叉编译环境,其中/path/to/cross-compile指交叉编译器目录
#如/home/user/toolchain/arm-linux-gnueabihf/bin
export PATH=$PATH:/path/to/cross-compile
#配置,其中/path/to/prefix指编译安装目录
#如/home/user/toolchain/arm-linux-gnueabihf/arm-linux-gnueabihf
#把编译结果安装在交叉编译器中,否则引用到该库需要指定对应的目录
./configure --prefix=/path/to/prefix \
--host=arm-linux-gnueabihf \
--enable-option-checking
#编译
make
#安装
make install

  1.5、xcb-util-renderutil

  下载地址:Index of /releases/individual/xcbhttps://www.x.org/releases/individual/xcb/

#解压
tar -zxvf xcb-util-renderutil-0.3.9.tar.gz
cd xcb-util-renderutil-0.3.9
#交叉编译环境,其中/path/to/cross-compile指交叉编译器目录
#如/home/user/toolchain/arm-linux-gnueabihf/bin
export PATH=$PATH:/path/to/cross-compile
#配置,其中/path/to/prefix指编译安装目录
#如/home/user/toolchain/arm-linux-gnueabihf/arm-linux-gnueabihf
#把编译结果安装在交叉编译器中,否则引用到该库需要指定对应的目录
./configure --prefix=/path/to/prefix \
--host=arm-linux-gnueabihf \
--enable-option-checking
#编译
make
#安装
make install

 1.6、zlib

  下载地址:zlib Home Site

#解压
tar -zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
#配置,其中/path/to/prefix指编译安装目录
#如/home/user/toolchain/arm-linux-gnueabihf/arm-linux-gnueabihf
#把编译结果安装在交叉编译器中,否则引用到该库需要指定对应的目录
CC=/home/user/toolchain/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc \
./configure --prefix=/path/to/prefix
#编译
make
#安装
make install

  1.7、xz-utils

  下载地址:XZ Utils

#解压
tar -zxvf xz-5.2.5.tar.gz
cd xz-5.2.5
#交叉编译环境,其中/path/to/cross-compile指交叉编译器目录
#如/home/user/toolchain/arm-linux-gnueabihf/bin
export PATH=$PATH:/path/to/cross-compile
#配置,其中/path/to/prefix指编译安装目录
#如/home/user/toolchain/arm-linux-gnueabihf/arm-linux-gnueabihf
#把编译结果安装在交叉编译器中,否则引用到该库需要指定对应的目录
./configure --prefix=/path/to/prefix \
--host=arm-linux-gnueabihf
#编译
make
#安装
make install

 1.8、icu

  下载地址:GitHub - unicode-org/icu: The new home of the ICU project source code.

#解压
tar -zxvf icu-release-70-1.tar.gz
cd icu-release-70-1/icu4c/source
#新建build目录
mkdir build
#新建config目录
mkdir config
touch icucross.mk
touch icucross.inc
#交叉编译环境,其中/path/to/cross-compile指交叉编译器目录
#如/home/user/toolchain/arm-linux-gnueabihf/bin
export PATH=$PATH:/path/to/cross-compile
#配置,其中/path/to/prefix指编译安装目录
#如/home/user/toolchain/arm-linux-gnueabihf/arm-linux-gnueabihf
#把编译结果安装在交叉编译器中,否则引用到该库需要指定对应的目录
./configure --prefix=/home/user/toolchain/arm-linux-gnueabihf/arm-linux-gnueabihf \
--host=arm-linux-gnueabihf \
--enable-option-checking \
--with-cross-build=/home/user/toolchain/icu-release-70-1/icu4c/source/build
#编译
make
#安装
make install

1.9、libxml

  下载地址:ftp://xmlsoft.org/libxml2/

#解压
tar -zxvf xcb-util-renderutil-0.3.9.tar.gz
cd xcb-util-renderutil-0.3.9
#交叉编译环境,其中/path/to/cross-compile指交叉编译器目录
#如/home/user/toolchain/arm-linux-gnueabihf/bin
export PATH=$PATH:/path/to/cross-compile
#配置,其中/path/to/prefix指编译安装目录
#如/home/user/toolchain/arm-linux-gnueabihf/arm-linux-gnueabihf
#把编译结果安装在交叉编译器中,否则引用到该库需要指定对应的目录
./configure --prefix=/path/to/prefix \
--host=arm-linux-gnueabihf \
--enable-option-checking \
--with-python=/home/user/toolchain/arm-linux-gnueabihf/arm-linux-gnueabihf/lib
#编译
make
#安装
make install

 1.10、xkeyboard-config

   下载地址:https://www.x.org/releases/individual/data/xkeyboard-config/xkeyboard-config-2.30.tar.gzhttps://www.x.org/releases/individual/data/xkeyboard-config/xkeyboard-config-2.30.tar.gz

#解压
tar -zxvf xkeyboard-config-2.30.tar.gz
cd xkeyboard-config-2.30
#交叉编译环境,其中/path/to/cross-compile指交叉编译器目录
#如/home/user/toolchain/arm-linux-gnueabihf/bin
export PATH=$PATH:/path/to/cross-compile
#配置,其中/path/to/prefix指编译安装目录
#如/home/user/toolchain/arm-linux-gnueabihf/arm-linux-gnueabihf
#把编译结果安装在交叉编译器中,否则引用到该库需要指定对应的目录
./configure --prefix=/path/to/prefix \
--host=arm-linux-gnueabihf \
--enable-option-checking
#编译
make
#安装
make install

 1.11、libxkbcommon

  下载地址:xkbcommon - a keyboard handling libraryhttps://www.xkbcommon.org/

#解压
xz -d libxkbcommon-1.4.0.tar.xz
tar -xvf libxkbcommon-1.4.0.tar
cd libxkbcommon-1.4.0
#新建交叉编译配置
nano cross.txt

cross.txt内容如下:

[binaries]
c = '/home/user/toolchain/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc'
cpp = '/home/user/toolchain/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-c++'
ar = '/home/user/toolchain/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ar'
strip = '/home/user/toolchain/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-strip'
ld = '/home/sam/toolchain/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ld'
pkgconfig = '/usr/bin/pkg-config'
cmake = '/usr/bin/cmake'[properties]
skip_sanity_check = true
c_link_args = ['-llzma', '-lz','-lXau', '-lxml2'][paths]
libdir = '/home/user/toolchain/arm-linux-gnueabihf/arm-linux-gnueabihf/lib'
includedir = '/home/user/toolchain/arm-linux-gnueabihf/arm-linux-gnueabihf/include'
prefix = '/home/user/toolchain/arm-linux-gnueabihf/arm-linux-gnueabihf'[host_machine]
system = 'linux'
cpu_family = 'arm'
cpu = 'ARM'
endian = 'little'[build_machine]
system = 'linux'
cpu_family = 'x86_64'
cpu = 'i686'
endian = 'little'
#安装依赖
sudo apt install bison
#配置,其中/path/to/prefix指编译安装目录
#如/home/user/toolchain/arm-linux-gnueabihf/arm-linux-gnueabihf
#把编译结果安装在交叉编译器中,否则引用到该库需要指定对应的目录
meson setup build --prefix /path/to/prefix \
--buildtype release \
--cross-file cross.txt \
-Denable-x11=false \
-Denable-wayland=false \
-Denable-docs=false \
-Denable-xkbregistry=false \
-Dxkb-config-root=/home/user/toolchain/arm-linux-gnueabihf/arm-linux-gnueabihf/lib/pkgconfig
#编译安装
ninja -C build install

2、交叉编译Qt

        2.1、文件qmake.conf

#
# qmake configuration for building with arm-linux-gnueabi-g++
#MAKEFILE_GENERATOR      = UNIX
CONFIG                 += incremental
QMAKE_INCREMENTAL_STYLE = sublibinclude(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)QMAKE_INCDIR            += /home/sam/ArmToolchain/arm-linux-gnueabihf/arm-linux-gnueabihf/include
QMAKE_LIBDIR            += /home/sam/ArmToolchain/arm-linux-gnueabihf/arm-linux-gnueabihf/lib
QMAKE_LIBS              += -lXau
QMAKE_LIBS              += -lxcb
QMAKE_LIBS              += -lxcb-xkb
QMAKE_LIBS              += -lxkbcommon
QMAKE_LIBS              += -lxkbcommon-x11# modifications to g++.conf
QMAKE_CC                = /home/sam/ArmToolchain/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
QMAKE_CXX               = /home/sam/ArmToolchain/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
QMAKE_LINK              = /home/sam/ArmToolchain/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
QMAKE_LINK_SHLIB        = /home/sam/ArmToolchain/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++# modifications to linux.conf
QMAKE_AR                = /home/sam/ArmToolchain/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY           = /home/sam/ArmToolchain/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-objcopy
QMAKE_NM                = /home/sam/ArmToolchain/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-nm -P
QMAKE_STRIP             = /home/sam/ArmToolchain/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-strip
load(qt_config)

        2.2、脚本configure.sh

#! /bin/bash../configure \
-prefix /home/user/toolchain/arm-linux-gnueabihf/arm-linux-gnueabihf/ \
-opensource \
-confirm-license \
-release \
-xplatform linux-arm-gnueabihf-g++ \
-make libs \
-nomake examples \
-nomake tools \
-nomake tests \
-no-opengl \
-skip qt3d \
-skip qtactiveqt \
-skip qtandroidextras \
-skip qtcharts \
-skip qtconnectivity \
-skip qtdatavis3d \
-skip qtdeclarative \
-skip qtdoc \
-skip qtgamepad \
-skip qtgraphicaleffects \
-skip qtimageformats \
-skip qtlocation \
-skip qtlottie \
-skip qtmacextras \
-skip qtmultimedia \
-skip qtnetworkauth \
-skip qtpurchasing \
-skip qtquick3d \
-skip qtquickcontrols \
-skip qtquickcontrols2 \
-skip qtquicktimeline \
-skip qtremoteobjects \
-skip qtscript \
-skip qtscxml \
-skip qtsensors \
-skip qtserialbus \
-skip qtserialport \
-skip qtspeech \
-skip qtsvg \
-skip qttools \
-skip qttranslations \
-skip qtvirtualkeyboard \
-skip qtwayland \
-skip qtwebchannel \
-skip qtwebglplugin \
-skip qtwebsockets \
-skip qtwebview \
-skip qtwinextras \
-skip qtx11extras \
-skip qtxmlpatterns \
-xkbcommon \
-qpa xcb
-xcb

2.3、执行编译

./configure.sh
make && make install

执行配置脚本的结果

 


http://chatgpt.dhexx.cn/article/drtF2w3u.shtml

相关文章

Spyder打开时报错:Could not load the Qt platform plugin “xcb“ in ““ even though it was found.

目录 前言 一、打开spyder时报错 This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. 二、解决问题 问题应该是PyQt5的版本太高,和spyder版本不匹配了 附上一个跟PyQt匹配…

Qt程序报错:could not find or load the Qt platform plugin “xcb“ in ““.

Qt开发,在开发机上生成了可执行文件之后,连同其相关的共享库,一起拷贝至目标机: 双击没反应。用终端运行提示: This application failed to start because it could not find or load the Qt platform plugin "x…

Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题

Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin "xcb"问题 问题描述定位问题解决方法后记 问题描述 安装Qt5.15.0后,在运行测试用例时弹出错误: qt.qpa.plugin: Could not load the Qt platform plugin "…

Could not load the Qt platform plugin “xcb“ in...问题解决

在Linux上用Vscode调试MAPPO代码时碰到“Could not load the Qt platform plugin “xcb” in…”问题,问题详细描述如下: qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/cloris/anaconda3/envs/py37/lib/pytho…

wsl ubuntu22.04 conda环境安装labelImg解决xcb缺失问题

labelImg 安装 pip install PyQt5 -i https://pypi.tuna.tsinghua.edu.cn/simple/ pip install pyqt5-tools -i https://pypi.tuna.tsinghua.edu.cn/simple/ pip install lxml -i https://pypi.tuna.tsinghua.edu.cn/simple/ pip install labelImg -i https://pypi.tuna.tsingh…

Ubuntu20.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“ 问题

问题描述 python调用matplotlib.pyplot库进行图形绘制时弹出错误提示: qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found. This application failed to start because no Qt platform plugin could be initi…

解决qt.qpa.plugin: Could not load the Qt platform plugin “xcb“ in ““ even though it was found.

项目场景: 在使用pyqt5出现问题,让人真的很头疼哇 问题描述 具体问题如下: qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found. This application failed to start becaus…

编译xcb

银河麒麟V10 ARM CPU, 在源码安装Qt5.12.8的时候发现加了-qt-xcb选项之后,会出现如下错误: RROR: Feature xcb was enabled, but the pre-condition features.thread && features.xkbcommon && libs.xcb failed 网上查了一圈&#xf…

交叉编译libxcb与X11

交叉编译libxcb与X11 编译前提工具安装 编译X11编译依赖项Xtrans编译依赖项xorgprotoXCB完成后编译X11X11完成 编译xcb编译依赖项xcb-proto编译依赖项libXau最后编译xcbXCB完成 扩展编译Xrandr编译依赖项util-macros编译依赖项Xrender编译依赖项Xext最后编译Xrandr 编译xcb-uti…

BGP基础

简述 在EGP协议中,引入了AS(Autonomous System,自治系统)的概念。AS是指由同一个技术管理机构管理,使用统一选路策略的一些路由器的集合。AS的内部使用IGP来计算和发现路由,同一个AS内部的路由器之间是相互…

BGP的各种属性

* BGP不会学习路由, 只会传递路由 * BGP选路原则 -- BGP的度量值叫做路径属性 -- 特有的属性包括: * 公认必选属性(AS-Path、Next-hop...) * 公认自选属性 * 任选可透明传递属性 * 任选非可透明传送属性 -- 公认属性: …

BGP简介、BGP与IGP的区别、BGP的优势有哪些?

BGP的背景 为方便管理规模不断扩大的网络,网络被分成了不同的AS(Autonomous System,自治系统)。 早期,EGP(Exterior Gateway Protocol,外部网关协议)被用于实现在AS之间动态交换路由…

BGP路由反射器RR

曾子曰:“吾日三省吾身:为人谋而不忠乎?与朋友交而不信乎?传不习乎?” 文章目录 一、拓扑二、基础配置与分析三、BGP 13 条选路原则四、BGP路由反射器RR五、备份路由反射器 EBGP 对等体之间是不存在 BGP 路由反射器的…

BGP学习笔记

BGP的特征: BGP是外部路由协议,用来在AS之间传递路由信息。是一种路径矢量(Path-Vector)路由协议(AS_PATH)。 可靠的路由更新机制(TCP)(目的端口为179,源端口…

BGP命令行配置

BGP命令行简介 配置BGP的基本功能: 启动BGP进程: bgp 100//启动bgp指定as号 router-id 1.1.1.1 //配置BGP的router-id配置BGP对等体: 配置BGP对等体时,如果指定对等体所属的AS编号与本地AS编号相同,表示配置IBGP对…

BGP简介,以及使用BGP的原因

通过本篇可以理解 BGP 的基础知识以及使用它的原因 BGP(边界网关协议)是将互联网联合在一起的路由协议,我将解释在哪些情况下我们需要 BGP 以及它是如何工作的。 在您继续阅读之前,我应该告诉您“忘记”迄今为止您对RIP、OSPF和…

BGP属性

一、属性分类 BGP属性是BGP进行路由决策和控制的重要信息。它可以分为如下两大类四小类: 一、公认属性 公认必遵(Well-known mandatory )公认可选(Well-known di scretionary ) 公认属性是所有运行BGP协议的系统都必须识别和支持的属性。 其中,公认必遵属性是BGP…

BGP的基本配置

目录 1,BGP建邻的基本配置 1,EBGP对等体关系直连建邻 2,IBGP对等体关系之间的环回建邻 3,EBGP对等体关系之间的非直连建邻 2,发布路由 1,network --- 在BGP中只能用来发布路由条目信息 2&#xff0c…

BGP与IGP之间的区别

IGP: interior gateway protocol—链路状态 BGP: border gateway protocol—距离矢量 都是实现路由信息的交换、学习 都能实现路由的功能 BGP一般用于大型网络,可容纳的路由信息更多;而IGP协议,对于路由条目的存储量是有限的&a…

BGP的应用

目录 实验需求:按照规划建立BGP对等关系,R1和R5各发布一条路由,保证两个网段可以互相通信 1.首先配置IP r1 r2 r3 r4 r5 2.AS之间建立EBGP直连邻居关系 r1和r2之间 r4和r5之间 3.AS内部建立IBGP对等体邻居关系 首先建立ospf使内部建…