当前位置:网站首页>工作小计 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
边栏推荐
- 386. Lexicographical Numbers
- Optimize the query (work in progress)
- 如何设计 DAO 的 PoW 评判标准 并平衡不可能三角
- Golang第二章:程序结构
- UVa 10003 - Cutting Sticks(白书,区间DP)
- 互联网用户账号信息管理规定今起施行:必须严打账号买卖灰产
- 385. Mini Parser
- 斩获双奖|易知微荣获“2021中国数字孪生解决方案优秀供应商”“中国智能制造优秀推荐产品”双奖项!
- Teach a Man How to Fish - How to Query the Properties of Any SAP UI5 Control by Yourself Documentation and Technical Implementation Details Demo
- 数据一致性:双删为什么要延时?
猜你喜欢
随机推荐
网络基础学习系列四(网络层,数据链路层和一些其他重要协议或技术)
Summary bug 】 【 Elipse garbled solution project code in Chinese!
483. Smallest Good Base
用于流动质押和收益生成的 Web3 基础设施
FVCOM 3D Numerical Simulation of Hydrodynamics, Water Exchange, Dispersion and Transport of Oil Spills丨FVCOM Model Watershed, Numerical Simulation Method of Marine Water Environment
488. Zuma Game
4年工作经验,多线程间的5种通信方式都说不出来,你敢信?
Shell编程的条件语句
【day6】类与对象、封装、构造方法
东西向和南北向通信的统一
嵌入式系统:概述
HCIP第十六天
What is Adobe?
HCIP第十三天
Flutter 桌面探索 | 自定义可拖拽导航栏
Causes of Mysql Disk Holes and Several Ways to Rebuild Tables
图的基础概念
藏宝计划TreasureProject(TPC)系统模式开发技术原理
Optimize the query (work in progress)
FinClip最易用的智能电视小程序