Linux下打包Qt-使用linuxDeployQt+appimageTool
2023-12-13 04:29:45
使用linuxDeployQt+appimageTool打包Qt程序
使用linuxdeployqt打包
使用linuxdeployqt打包时,出现
sh: 1: appimagetool: not found
而appimagetool简单来说是一个将程序打包为后缀.AppImage的工具,AppImage可以直接双击运行
https://www.cnblogs.com/pipci/p/16109756.html
下载appimagetool和linuxdeployqt
下载链接
https://pan.baidu.com/s/1BGm_btMIe75uW9hOC09Xlg
提取码: 7ayh
https://blog.csdn.net/bkbliu/article/details/88090465
下载后,修改名字和权限,移动到usr/local/bin目录下
- 修改appimagetool名字,权限,目录
$ sudo mv appimagetool-x86_64.AppImage appimagetool
$ sudo chmod +x appimagetool
$ sudo mv appimagetool /usr/local/bin
- 同样修改linuxdeployqt名字,权限,目录
- 将patchelf-x86_64也移动到/usr/local/bin目录下
使用命令查看版本
$ linuxdeployqt -version
linuxdeployqt (commit ), build <local dev build> built on 2023-11-23 06:44:45 UTC
$ appimagetool -v
appimagetool, continuous build (commit 225057b), build 1874 built on 2018-10-21 12:21:27 UTC
SOURCE is missing
$ patchelf --version
patchelf 0.14.3
出现版本号即可
创建打包文件夹
目录如下
yourApp.AppDir/ ---- lib/*.so
---- yourApp
---- yourApp.desktop
---- youApp.png
使用linuxdeployqt打包
进入yourApp.AppDir目录
$ linuxdeployqt EMS_Tool -appimage
linuxdeployqt (commit ), build <local dev build> built on 2023-11-23 06:44:45 UTC
Not using FHS-like mode
app-binary: "/yourAppDir/yourApp"
appDirPath: "/yourAppDir"
relativeBinPath: "yourAppDir"
appimagetool, continuous build (commit 225057b), build 1874 built on 2018-10-21 12:21:27 UTC
Desktop file: /yourAppDir/Ems.desktop
Name: yourApp
Icon: yourAppDirs.png
Exec: yourAppDir
Comment: yourAppDir
Type: Application
Categories entry not found in desktop file
Categories: (null)
/yourAppDir/plugins/imageformats/libqtga.so used for determining architecture x86_64
/yourAppDir/plugins/imageformats/libqtiff.so used for determining architecture x86_64
/yourAppDir/plugins/imageformats/libqjpeg.so used for determining architecture x86_64
/yourAppDir/plugins/imageformats/libqsvg.so used for determining architecture x86_64
/yourAppDir/plugins/imageformats/libqwbmp.so used for determining architecture x86_64
/yourAppDir/plugins/imageformats/libqico.so used for determining architecture x86_64
/yourAppDir/plugins/imageformats/libqicns.so used for determining architecture x86_64
/yourAppDir/plugins/imageformats/libqgif.so used for determining architecture x86_64
/yourAppDir/plugins/imageformats/libqwebp.so used for determining architecture x86_64
/yourAppDir/plugins/xcbglintegrations/libqxcb-egl-integration.so used for determining architecture x86_64
/yourAppDir/plugins/xcbglintegrations/libqxcb-glx-integration.so used for determining architecture x86_64
/yourAppDir/plugins/printsupport/libcupsprintersupport.so used for determining architecture x86_64
/yourAppDir/plugins/iconengines/libqsvgicon.so used for determining architecture x86_64
/yourAppDir/plugins/platforms/libqxcb.so used for determining architecture x86_64
/yourAppDir/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so used for determining architecture x86_64
/yourAppDir/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so used for determining architecture x86_64
/yourAppDir/plugins/platforminputcontexts/libqtvirtualkeyboardplugin.so used for determining architecture x86_64
/yourAppDir/lib/libcups.so.2 used for determining architecture x86_64
App name for filename: Ems
/yourAppDir should be packaged as yourApp.AppImage
/yourApp.png{.png,.svg,.svgz,.xpm} defined in desktop file but not found
For example, you could put a 256x256 pixel png into
/yourApp.png
修改.desktop中的Icons图标目录
Icon=yourAppName
再次打包
成功后,在yourApp.AppDir下有lib、plugins、translations目录,AppRun、yourApp、yourApp.desktop、qt.conf、yourApp.png、yourApp-x86_64.AppImage文件
运行
双击yourApp-x86_64.AppImage,正常出现界面
但是将拖动到桌面后,无法双击运行,只能右键“Run as a Program”才能运行成功
https://blog.csdn.net/leoeitail/article/details/93708901
https://github.com/probonopd/linuxdeployqt
https://github.com/AppImage/AppImageKit/releases/
文章来源:https://blog.csdn.net/LiHong333/article/details/134830569
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!