linux下Qt使用LinuxDeployqt打包

linux下Qt使用LinuxDeployqt打包

环境: Ubuntu2204

一、直接使用linuxDeployqt程序打包

1.下载linuxdeployqt-continuous-x86_64.AppImage

https://github.com/probonopd/linuxdeployqt/releases

2.修改名称和权限

mv linuxDeployqt-x86_64.AppImage linuxdeployqt
sudo chmod +x linuxdeployqt

3.配置QT环境变量

export PATH=/opt/qt5.12/5.12.12/gcc_64/bin:$PATH
export LIB_PATH=/opt/qt5.12/5.12.12/gcc_64/lib:$LIB_PATH
export PLUGIN_PATH=qt5.12/5.12.12/gcc_64/plugins:$PLUGIN_PATH
export QML2_PATH=qt5.12/5.12.12/gcc_64/qml:$QML2_PATH

4. 将Qt应用拷贝到某个目录下

使用linuxDeployqt命令打包

linuxDeployqt xxx -appimage

xxx: 改为自己要打包的应用名称

输出
Error: The host system is too new.
原因

ubuntu版本太新

二、另一个方法下载linuxDeployqt源码并编译

1. 下载tar源码, 解压

https://github.com/probonopd/linuxdeployqt/releases
https://download.csdn.net/download/LiHong333/88565443

2. 编译源码

在linuxdeployqt-continuous/tools/linuxdeployqt目录下找到main.cpp文件,修改版本判断,将下面的代码屏蔽;

//if (strverscmp (glcv, "2.32") >= 0) {
   
        //    qInfo() << "ERROR: The host system is too new.";
        //    qInfo() << "Please run on a system with a glibc version no newer than what comes with the oldest";
        //    qInfo() << "currently supported mainstream distribution (Ubuntu Focal Fossa), which is glibc 2.31.";
        //    qInfo() << "This is so that the resulting bundle will work on most still-supported Linux distributions.";
        //    qInfo() << "For more information, please see";
        //    qInfo() << "https://github.com/probonopd/linuxdeployqt/issues/340";
        //    return 1;
        //}

3. 在linuxdeployqt-continuous目录下编译

/linuxdeployqt-continuous$ qmake
/linuxdeployqt-continuous$ make
cd src/ && ( test -e Makefile || /opt/qt5.12/5.12.12/gcc_64/bin/qmake -o Makefile /linuxdeployqt-continuous/src/src.pro ) && make -f Makefile 
make[1]: Entering directory '/linuxdeployqt-continuous/src'
make[1]: Nothing to be done for 'first'.
  • 20
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值