当前位置:网站首页>工作小计 QT打包
工作小计 QT打包
2022-08-03 22:23:00 【Zip-List】
工作小计 QT打包
qt的程序调试好了后,如果需要发给其他人,需要连带库等文件一起打包
需要工具linuxdeployqt,源码编译好后,加入可执行路径
版本报错就高版本运行linuxdeployqt,注释掉部分代码即可
linuxdeployqt XXX -no-strip
#-no-strip会使得文件变大,保留更多的信息
执行完毕后,发现多了qt.conf文件和lib plugins translations三个文件夹
---bin
---xxx
---qt.conf
---lib
---plugins
---translations
可以看到qt.conf把依赖文件都生成好放入了对应的文件夹中
# Generated by linuxdeployqt
# https://github.com/probonopd/linuxdeployqt/
[Paths]
Prefix = ../
Plugins = plugins
Imports = qml
Qml2Imports = qml
此时可以直接执行以下xxx文件,发现报错缺少qt的部分组件,qml没有找到。将qt对应的qml文件夹拷贝到当前目录
cp /home/test/Qt/5.15.2/gcc_64/qml ./ -r
如果仍然缺少文件,把ldd需要链接的文件全给他链接过去,执行copylib.sh xxx
#!/bin/sh
bin=$1 #发布的程序名称
desDir="../lib" #你的路径,在这里就是上一级目录里的lib
if [ ! -d $desDir ];then
#echo "makedir $desDir"
mkdir $desDir
fi
libList=$(ldd $bin | awk '{
if (match($3,"/")){
printf("%s "),$3 } }')
cp $libList $desDir
启动脚本搞一下,链接上对应的库
PWD=`pwd`
export LD_LIBRARY_PATH=${
PWD}/lib:$LD_LIBRARY_PATH
nohup ./bin/xxx&
打包
zip pkg.zip ./bin/ ./translations/ ./qml/ ./lib ./plugins/ run.sh -r
收到包后执行run.sh即可
qt相关的bashrc设置
#run qt
export QT_DIR=~/Qt/5.15.2/gcc_64/
export Qt5_DIR=~/Qt/5.15.2/gcc_64/
#qtdeploy
export QTDIR=~/Qt/5.15.2
export PATH=${QTDIR}/gcc_64/bin:~/Qt/Tools/QtCreator/bin:~/Qt/Tools/QtDesignStudio/bin:$PATH
export LD_LIBRARY_PATH=${QTDIR}/gcc_64/lib:~/Qt/Tools/QtCreator/lib/Qt/lib/:$LD_LIBRARY_PATH
export QML_IMPORT_PATH=${QTDIR}/gcc_64/qml
边栏推荐
- 【历史上的今天】8 月 3 日:微软研究院的创始人诞生;陌陌正式上线;苹果发布 Newton OS
- CAS:122567-66-2_DSPE-Biotin_DSPE-Biotin
- 图的基础概念
- 生成器版和查看器版有什么区别?
- 【MySQL进阶】数据库与表的创建和管理
- HCIP第十四天
- Golang第一章:入门
- 嵌入式系统:时钟
- Internet user account information management regulations come into effect today: must crack down on account trading and gray products
- 466. Count The Repetitions
猜你喜欢
随机推荐
Cisco ike2 IPSec配置
目标检测技术研究现状及发展趋势
云平台建设解决方案
472. Concatenated Words
HCIP BGP实验报告
YOLO之父宣布退出CV界,坦言无法忽视自己工作带来的负面影响
Bytebase database schema change management tool
Causes of Mysql Disk Holes and Several Ways to Rebuild Tables
CAS:1797415-74-7_TAMRA-Azide-PEG-Biotin
Embedded Systems: Clocks
UVa 1025 - A Spy in the Metro(白书)
UVa 437 - The Tower of Babylon (White Book)
start with connect by 实现递归查询
嵌入式系统:概述
navicat 连接 mongodb 报错[13][Unauthorized] command listDatabases requires authentication
Basic Concepts of Graphs
HDU 5655 CA Loves Stick
Flutter 桌面探索 | 自定义可拖拽导航栏
优化查询(工作中)
如何基于WPF写一款数据库文档管理工具(二)









