树莓派4b qt打包软件
用的树莓派4b, 下载的32位系统bullseye , glibc2.31 兼容性更高
https://downloads.raspberrypi.com/raspios_oldstable_armhf/images/raspios_oldstable_armhf-2025-05-07/
2025-05-06-raspios-bullseye-armhf.img.xz 2025-05-06 14:51 904M
用官方烧写软件烧写镜像;
更改树莓派 Raspberry Pi OS (bullseye) 镜像源
树莓派系统基于 Debian,但其软件源分为两部分:Raspbian(Debian 的 ARM 交叉编译版本)和 Raspberrypi(树莓派专用软件包)。因此,需要修改两个文件。
备份原配置文件:
bash
Copy Code
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo cp /etc/apt/sources.list.d/raspi.list /etc/apt/sources.list.d/raspi.list.bak
编辑 Raspbian 源文件:
sudo nano /etc/apt/sources.list
对于 armhf 架构(32位):添加以下内容(以清华源为例):
deb [arch=armhf] http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ bullseye main non-free contrib rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ bullseye main non-free contrib rpi
对于 aarch64 架构(64位):添加以下内容(以清华源为例):
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bullseye-security main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bullseye-security main contrib non-free
编辑 Raspberrypi 源文件:
sudo nano /etc/apt/sources.list.d/raspi.list
删除文件中所有内容,替换为以下内容(以阿里云镜像为例):
deb https:///mirrors.tuna.tsinghua.edu.cn/raspberrypi/ bullseye main
更新软件包列表:
sudo apt update
安装qt
更新系统软件包列表:
bash
sudo apt update
sudo apt upgrade
安装必要的构建工具和基础库:
bash
sudo apt install build-essential libgl1-mesa-dev
这一步安装了编译Qt应用程序所需的基础工具和OpenGL库。
安装Qt核心开发库和工具:
bash
sudo apt install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
qtbase5-dev 是Qt 5的核心开发库,qt5-qmake 是项目构建工具。
(可选)安装Qt Creator集成开发环境:
bash
sudo apt install qtcreator
安装后,你可以在应用程序菜单中找到它。
(可选)安装额外模块:
根据你的项目需要,可以选择安装其他模块,例如:
bash
如果需要开发图形界面应用
sudo apt install qtdeclarative5-dev
如果需要串口通信功能
sudo apt install libqt5serialport5-dev
打开qtcreator kit里面配置一下qmake
/usr/lib/qt5/bin/qmake
g++ gcc都配置一下
重新载入工程即可编译;
https://github.com/probonopd/linuxdeployqt/releases/tag/continuous
下载编译 linuxdeployqt 的source源码编译成32位的
解压
文件夹里面执行 qmake
然后 make
等待,在bin文件夹里面找到linuxdeployqt就是执行文件
linuxdeployqt 你的app -appimage
出错, 安装pachelf
sudo apt install pachelf
重新执行打包
即可完成。

浙公网安备 33010602011771号