精华内容
下载资源
问答
  • linuxqt打包工具linuxdeployqt,包含有使用方法,一站式的服务,亲测没任何问题
  • 基于Windows-Qt 发布的打包工具windeployqt,主要打包Qt相关依赖库,但是在linuxqt官方并未发布对应的打包版本。在github中,有人开源了这个版本linuxdeployqt,之前一直知道但是没怎么用,最近因为要打包对应工程...

    linuxdeployqt

    简介

    基于Windows-Qt 发布的打包工具windeployqt,主要打包Qt相关依赖库,但是在linux,qt官方并未发布对应的打包版本。在github中,有人开源了这个版本linuxdeployqt,之前一直知道但是没怎么用,最近因为要打包对应工程,又拿出研究了一下。

    • Windows介绍
    The Windows deployment tool windeployqt is designed to automate the process of creating a deployable folder containing the Qt-related dependencies (libraries, QML imports, plugins, and translations) required to run the application from that folder. It creates a sandbox for Universal Windows Platform (UWP) or an installation tree for Windows desktop applications, which can be easily bundled into an installation package.
    

    看一下Windows命令。

    Qt Deploy Tool 6.0.3
    
    The simplest way to use windeployqt is to add the bin directory of your Qt
    installation (e.g. <QT_DIR\bin>) to the PATH variable and then run:
      windeployqt <path-to-app-binary>
    If ICU, etc. are not in the bin directory, they need to be in the PATH
    variable. If your application uses Qt Quick, run:
      windeployqt --qmldir <path-to-app-qml-files> <path-to-app-binary>
    
    Options:
      -?, -h, --help              Displays help on commandline options.
      --help-all                  Displays help including Qt specific options.
      -v, --version               Displays version information.
      --dir <directory>           Use directory instead of binary directory.
      --qmake <path>              Use specified qmake instead of qmake from PATH.
      --libdir <path>             Copy libraries to path.
      --plugindir <path>          Copy plugins to path.
      --debug                     Assume debug binaries.
      --release                   Assume release binaries.
      --pdb                       Deploy .pdb files (MSVC).
      --force                     Force updating files.
      --dry-run                   Simulation mode. Behave normally, but do not
                                  copy/update any files.
      --no-patchqt                Do not patch the Qt6Core library.
      --ignore-library-errors     Ignore errors when libraries cannot be found.
      --no-plugins                Skip plugin deployment.
      --no-libraries              Skip library deployment.
      --qmldir <directory>        Scan for QML-imports starting from directory.
      --qmlimport <directory>     Add the given path to the QML module search
                                  locations.
      --no-quick-import           Skip deployment of Qt Quick imports.
      --translations <languages>  A comma-separated list of languages to deploy
                                  (de,fi).
      --no-translations           Skip deployment of translations.
      --no-system-d3d-compiler    Skip deployment of the system D3D compiler.
      --compiler-runtime          Deploy compiler runtime (Desktop only).
      --no-virtualkeyboard        Disable deployment of the Virtual Keyboard.
      --no-compiler-runtime       Do not deploy compiler runtime (Desktop only).
      --json                      Print to stdout in JSON format.
      --no-opengl-sw              Do not deploy the software rasterizer library.
      --list <option>             Print only the names of the files copied.
                                  Available options:
                                   source:   absolute path of the source files
                                   target:   absolute path of the target files
                                   relative: paths of the target files, relative
                                             to the target directory
                                   mapping:  outputs the source and the relative
                                             target, suitable for use within an
                                             Appx mapping file
      --verbose <level>           Verbose level (0-2).
    
    Qt libraries can be added by passing their name (-xml) or removed by passing
    the name prepended by --no- (--no-xml). Available libraries:
    bluetooth concurrent core declarative designer designercomponents gamepad gui
    qthelp multimedia multimediawidgets multimediaquick network nfc opengl
    openglwidgets positioning printsupport qml qmltooling quick quickparticles
    quickwidgets script scripttools sensors serialport sql svg svgwidgets test
    websockets widgets winextras xml webenginecore webengine webenginewidgets 3dcore
    3drenderer 3dquick 3dquickrenderer 3dinput 3danimation 3dextras geoservices
    webchannel texttospeech serialbus webview
    
    Arguments:
      [files]                     Binaries or directory containing the binary.
    
    • linux介绍
    This Linux Deployment Tool, linuxdeployqt, takes an application as input and makes it self-contained by copying in the resources that the application uses (like libraries, graphics, and plugins) into a bundle. The resulting bundle can be distributed as an AppDir or as an AppImage to users, or can be put into cross-distribution packages. It can be used as part of the build process to deploy applications written in C, C++, and other compiled languages with systems like CMake, qmake, and make. When used on Qt-based applications, it can bundle a specific minimal subset of Qt required to run the application.
    

    帮助文档:

    linuxdeployqt 7 (commit d41e234), build <local dev build> built on 2021-05-31 09:46:09 UTC
    
    Usage: linuxdeployqt <app-binary|desktop file> [options]
    
    Options:
       -always-overwrite        : Copy files even if the target file exists.
       -appimage                : Create an AppImage (implies -bundle-non-qt-libs).
       -bundle-non-qt-libs      : Also bundle non-core, non-Qt libraries.
       -exclude-libs=<list>     : List of libraries which should be excluded,
                                  separated by comma.
       -ignore-glob=<glob>      : Glob pattern relative to appdir to ignore when
                                  searching for libraries.
       -executable=<path>       : Let the given executable use the deployed libraries
                                  too
       -extra-plugins=<list>    : List of extra plugins which should be deployed,
                                  separated by comma.
       -no-copy-copyright-files : Skip deployment of copyright files.
       -no-plugins              : Skip plugin deployment.
       -no-strip                : Don't run 'strip' on the binaries.
       -no-translations         : Skip deployment of translations.
       -qmake=<path>            : The qmake executable to use.
       -qmldir=<path>           : Scan for QML imports in the given path.
       -qmlimport=<path>        : Add the given path to QML module search locations.
       -show-exclude-libs       : Print exclude libraries list.
       -verbose=<0-3>           : 0 = no output, 1 = error/warning (default),
                                  2 = normal, 3 = debug.
       -updateinformation=<update string>        : Embed update information STRING; if zsyncmake is installed, generate zsync file
       -version                 : Print version statement and exit.
    
    linuxdeployqt takes an application as input and makes it
    self-contained by copying in the Qt libraries and plugins that
    the application uses.
    
    By default it deploys the Qt instance that qmake on the $PATH points to.
    The '-qmake' option can be used to point to the qmake executable
    to be used instead.
    
    Plugins related to a Qt library are copied in with the library.
    
    See the "Deploying Applications on Linux" topic in the
    documentation for more information about deployment on Linux.
    

    编译

    下载

    git clone https://github.com/probonopd/linuxdeployqt.git -b 7 --depth 1
    

    博主下载了 tag 7

    编译-安装

    cd linuxdeployqt
    mkdir build
    cd build
    qmake ../linuxdeployqt.pro
    make -j
    sudo make install
    #安装路径:/opt/Qt/Qt5.9.5/5.9.5/gcc_64/bin/linuxdeployqt 。Qt默认安装路径。
    #ln -s /opt/Qt/Qt5.9.5/5.9.5/gcc_64/bin/linuxdeployqt /usr/bin/linuxdeployqt 配置为全局可执行程序
    

    其他相关库下载:

    #动态链接库工具(链接、重定向)
    wget https://nixos.org/releases/patchelf/patchelf-0.9/patchelf-0.9.tar.bz2
    tar xf patchelf-0.9.tar.bz2
    ( cd patchelf-0.9/ && ./configure  && make && sudo make install )
    
    #注意:根据对应平台下载(桌面-app生成工具)
    sudo wget -c "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" -O /usr/local/bin/appimagetool
    sudo chmod a+x /usr/local/bin/appimagetool
    

    测试

    linuxdeployqt配置为全局可执行程序后。开始测试:

    linuxdeployqt ./xxxx -verbose=2 -appimage
    #-verbose=<0-3> : 0 = no output, 1 = error/warning (default),2 = normal, 3 = debug.
    #-appimage      : Create an AppImage (implies -bundle-non-qt-libs).
    

    输出:

    Log: Creating  "xxxxxxxxxx/translations/qt_tterns_uk.qm" ...
    Log: "appimagetool -v 'xxxxxxxxxx' -n -g"
    appimagetool, continuous build (commit 8bbf694), build <local dev build> built on 2020-12-31 11:48:33 UTC
    NOTE: Using the output of 'git rev-parse --short HEAD' as the version:
          2eb7984
          Please set the $VERSION environment variable if this is not intended
    Desktop file: xxxxxxxxxxx/default.desktop
    Categories entry not found in desktop file
    .desktop file is missing a Categories= key
    Log: ret 256
    Log: WEXITSTATUS(ret) 1
    
    • 错误
    linuxdeployqt ./RdpClient
    linuxdeployqt 7 (commit d41e234), build <local dev build> built on 2021-05-31 09:46:09 UTC
    FHS-like mode with PREFIX, fhsPrefix: "/../.."
    QDir::exists: Empty or null file name
    ERROR: Error: Could not find app-binary ""
    

    安装包

    安装包路径

    下载完之后,给与可执行权限chmod a+x linuxdeployqt-continuous-x86_64.AppImage,全局环境变量配置mv linuxdeployqt-continuous-x86_64.AppImage /usr/bin ,或者按照上述安装路径,mv linuxdeployqt-continuous-x86_64.AppImagelinuxdeployqt /opt/Qt/Qt5.9.5/gcc/bin/linuxdeployqt

    注意事项

    生成文件:

    AppRun  default.desktop  default.png  description-pak  doc  doc-pak  lib  Makefile    plugins  qt.conf  RdpClient  translations
    

    实际使用过程中:

    platformsplugins 应该位于同级目录。如下述。

    AppRun  default.desktop  default.png  description-pak  doc  doc-pak  lib  Makefile  platforms  plugins  qt.conf  RdpClient  translations
    

    而生成的目录路径如下:

    ├── plugins
    │   ├── iconengines
    │   ├── imageformats
    │   ├── platforminputcontexts
    │   ├── platforms
    │   └── xcbglintegrations
    

    需要做一个拷贝动作;mv lugins\platforms ./

    然后在执行相关打包工作。

    展开全文
  • linux qt 打包

    2020-12-22 15:09:00
    一:打包工具的下载 1.linuxdeployqthttps://download.csdn.net/download/leoeitail/11257960 2.patchelfhttps://download.csdn.net/download/leoeitail/11257992 3:appimagetoolhttps://download.csdn.net/...

    一:打包工具的下载


    1.linuxdeployqt
    https://download.csdn.net/download/leoeitail/11257960

    2.patchelf
    https://download.csdn.net/download/leoeitail/11257992

    3:appimagetool
    https://download.csdn.net/download/leoeitail/11257965

     

    二:配置linuxdeployqt


    1:将 linuxdeployqt-5-x86_64.AppImage 重新命名成配置 linuxdeployqt ,移动到 /usr/local/bin目录下

     
    1. sudo mv linuxdeployqt-continuous-x86_64.AppImage linuxdeployqt

    2. chmod 777 linuxdeployqt

    3. sudo mv ./linuxdeployqt /usr/local/bin

    4. sudo linuxdelpoyqt --version

    5. linuxdeployqt 4 (commit 988d294), build 481 built on 2018-02-02 15:05:23 UTC

    2.显示版本表示安装成功。

     

    三:配置patchelf


    1.下载并且解压文件夹,进入patchelf解压的文件夹后执行如下命令

     
    1. ./configure

    2. make

    3. sudo make install

    四:配置appimagetool


    1:将appimagetool-x86_64.AppImage重新命名成配置appimagetool,移动到 /usr/local/bin目录下

     
    1. sudo mv appimagetool-x86_64.AppImage appimagetool

    2. chmod 777 appimagetool

    3. sudo mv ./appimagetool /usr/local/bin

    五:进入/usr/local/bin目录,执行ls命令出现一下情况

    appimagetool  linuxdeployqt  patchelf

    表示配置成功

     

    六:开始打包程序


    1.随便一个目录创建一个文件夹命名为output.AppDir,我的就直接创建在桌面。比如说我的执行程序名字是demo123,将这个文件放到对应的bin目录下(就只放QTCreator release模式下编译的一个执行文件就可以了),这里面的结构我们梳理一下

     
    1. output.AppDir -- usr -- bin -- demo123

    2.                      -- lib -- *.so

    3.                      -- demo123.desktop

    4.                      -- demo123.png

    5.                      -- AppRun

    注意:
    lib文件夹是你的软件需要用到的动态库,将所有的动态库拷贝进去
    demo123.desktop,demo123.png,AppRun自行创建

    2.demo123.desktop中的代码

     
    1. [Desktop Entry]

    2. Version=1.0

    3. Name=appDesigner

    4. Exec=

    5. Terminal=false

    6. Type=Application

    7. Categories=Development;

    8. Icon=demo123

    9. StartupNotify=true

    10.  
    11. Name[en_US]=demo123.desktop


    4.AppRun中的代码

     
    1. #!/bin/bash

    2. HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

    3. echo "hERe is ${HERE}" //查看当前的路径

    4.  
    5. cd $HERE/usr/bin/

    6.  
    7. //设置环境变量

    8. export LD_LIBRARY_PATH=$HERE/usr/lib/qtlib:$HERE/usr/lib:$LD_LIBRARY_PATH

    9.  
    10. //运行执行文件

    11. ./demo123

    上述AppRun是一段脚本,你们再写的时候,也可以是一个执行文件。

    4.开始终端敲代码了。。。。。。

    linuxdeployqt demo123 -appimage
    这句结束之后,可能AppRun会被覆盖,不过没关系,将上述的代码重新覆盖一下就好了。


    appimagetool output.AppDir/
    这时候就会生成一个以 .AppImage结尾的执行文件,他就是最后生成出来的文件。

    双击即可。完成!

    1.  

    展开全文
  • linuxQT5 程序打包工具,打包完成后是一个单独可运行文件,就像window下exe文件一样双击可运行,可以脱离QT环境。主要是github下载操蛋,下载下来供各位朋友使用。
  • linux Qt程序打包(linuxdeployqt工具的使用)官方提供的最新版本基于Qt5.8的,用户可根据需要从源码编译成本机版本来使用,具体操作过程如下:工具1.linuxdeployqt 依赖工具: patchelf(必须) appimagetool(可选) 2....

    linux Qt程序打包(linuxdeployqt工具的使用)

    官方提供的最新版本基于Qt5.8的,用户可根据需要从源码编译成本机版本来使用,具体操作过程如下:


    工具


    1.linuxdeployqt

    2.Qt

    确保机器已经安装Qt

    如果需要制作成单文件程序,需要用到appimagetool,若不需要可不必下载

    步骤


    1. 官网提供详细步骤,这里说下注意事项
      下载下来的linuxdeployqt
      1.1 (界面编译)打开QtCreator,打开linuxdeployqt项目,直接构建即可,构建完成后在linuxdeployqt目录下可找到编译好的可执行文件(linuxdeployqt)
      1.2 (命令行)打开终端,进入linuxdeployqt项目目录,目录结构如下:

    ls
    BUILDING.md LICENSE.LGPLv3 linuxdeployqt.pro shared
    Dockerfile linuxdeployqt Makefile tests
    LICENSE.GPLv3 linuxdeployqt.AppDir README.md

    执行qmake之前先设置环境变量PATH

    export PATH=~/Qt5.xx.x/5.x/gcc_xx/bin:$PATH
    

    然后执行下

    qmake -v 
    

    查看下当前使用的qmake是否为你需要的版本
    设置完成后在linuxdeployqt项目目录下直接执行qmake,然后再执行make即可,不需要make install

    1.3 这样编译好后的可执行文件位于linuxdeployqt/linuxdeployqt下,将其复制至系统程序可执行目录下即可

    sudo mv linuxdeployqt/linuxdeployqt /usr/local/bin
    

    2.patchelf的编译与安装
    操作步骤:

    • ./configure
    • make
    • sudo make install (直接安装至系统目录即可)

    关于 appimagetool 的安装参照官网即可,直接用wget下载可能比较慢,可用迅雷或其他下载工具下载下来,然后拷贝至linux系统,具体操作步骤:

    suco cp ppimagetool-x86_64.AppImage /usr/local/bin/appimagetool
    sudo chmod a+x /usr/local/bin/appimagetool
    

    使用方法


    • 命令:
      linuxdeployqt ~/path/to/project/application -appimage

    appimage:若根据操作安装了 appimagetool 时该参数有效,使用该参数可将你需要打包的程序打包成单个文件;
    其他相关参数

    Options:
       -verbose=<0-3>      : 0 = no output, 1 = error/warning (default), 2 = normal, 3 = debug
       -no-plugins         : Skip plugin deployment
       -appimage           : Create an AppImage
       -no-strip           : Don't run 'strip' on the binaries
       -bundle-non-qt-libs : Also bundle non-core, non-Qt libraries
       -executable=<path>  : Let the given executable use the deployed libraries too
       -qmldir=<path>      : Scan for QML imports in the given path
       -always-overwrite   : Copy files even if the target file exists
    linuxdeployqt takes an application as input and makes it
    self-contained by copying in the Qt libraries and plugins that
    the application uses.
    

    官方文档

    create by vacant. 转载请注明

    展开全文
  • Qt Install FrameWork——Qt打包工具

    千次阅读 2016-01-04 17:56:35
    主要介绍三部分内容:Qt Install FrameWork安装、打包程序、程序安装、环境配置。一、Qt Install FrameWork安装 两种方式:编译源码、安装预编译好的Installer; 推荐安装预编译好的Installer。 下载链接:...

    主要介绍三部分内容:Qt Install FrameWork安装、打包程序、程序安装、环境配置。

    一、Qt Install FrameWork安装
    两种方式:编译源码、安装预编译好的Installer;
    推荐安装预编译好的Installer。
    下载链接:http://download.qt.io/official_releases/qt-installer-framework/
    可以选择最新版本下载。

    二、打包程序
    程序脚本:
    #!/bin/sh

    echo “Archive All…”

    archiveName=”test.7z” //压缩程序

    cd testSourceCode
    7z a -t7z $archiveName
    cd ..

    cp testSourceCode/$archiveName packages/test/data/

    rm -rf testSourceCode/$archiveName

    ../bin/binarycreator -f -c config/config.xml -p packages testInstaller //生成二进制文件

    三、程序安装
    。。。。。。

    四、环境配置
    通常程序需要依赖其他的库,如在Linux环境下,通常做法为:将依赖库复制到/lib下;此方法简单,方便;但是对于频繁的更新库,可能会导致库的更新不急时;
    第二种方法为:更新动态库的链接路径。
    如:写一个配置文件,test.conf,内容如下:
    /root/test/libs
    将此文件复制到/etc/ld.so.conf.d/ 目录下,然后运行ldconfig即可。

    展开全文
  • Linux系统打包QT程序

    2021-09-08 10:20:51
    当然你的Ubuntu肯定安装了QT工具,通过QCreator等工具编译出应用程序 2、下载linuxdeployqt 工具 linuxdeployqt 官网:https://github.com/probonopd/linuxdeployqt 进入 linuxdeployqt 修改文件 vim tools/...
  • Linux系统下QT打包程序

    2020-03-20 22:02:34
    Linux系统下QT打包程序环境具体过程 环境 Ubuntu 16.04LTS QT 具体过程 打开QT Creator,新建一个名为test的项目; 在项目中编辑任意内容; 在QT Creator下使用Release编译; (Debug编译的文件比较大,而Release小...
  • linux——打包qt程序

    2019-11-20 23:30:55
    首先linux打包qt程序需要两个集成工具包,分别是linuxdeployqt-5-x86_64.Appimage和appimagetool-x86_64.Appimage。 设置环境 下载好的linuxdeployqt-5-x86_64.Appimage是一个release版的执行文件,我们直接把它放...
  • LinuxQT程序打包

    2019-08-13 09:05:16
    本次,笔者采用linuxqt+appimage 进行打包,这样的好处不言而喻,打包后生成的是Image,这意味着对部署环境没有依赖,不需要安装配置库文件,只要打包没问题,在别的应用环境中是很好部署的。 一、环境搭建: 准备...
  • QtLinux、Windows端打包发布的讲解,主要讲述:Windows端的打包,使用Qt自带的windeployqt工具处理,然后再用Enigma Virtual Box软件简化打包,只需要拷贝一个exe文件至其他电脑运行,运行成功!
  • LinuxQT程序打包

    2020-09-05 15:22:31
    工具:patchelf cmake linuxdeploy 安装patchelf软件 sudo apt install patchelf 安装cmake软件 sudo apt install cmake 编译QT的环境变量,把环境变量写入~/.bashrc中,然后执行source命令,让其立即生效不...
  • 使用linuxdeployqt在linux下进行Qt打包发布(超详细)

    万次阅读 多人点赞 2020-05-27 15:13:59
    linux下对开发的Qt应用,进行拷贝依赖文件dll等,并打成deb安装包; 实现可安装、卸载,安装完毕自动在开始菜单下和桌面添加快捷方式; 卸载后自动删除快捷方式,以及删除应用生成的log文件。 测试环境:ubuntu ...
  • LinuxQT程序打包

    2020-10-20 14:42:37
    windows下打包Qt程序有对应的工具windeploy,linux没有自带的,便自己找。 ldd命令用于判断某个可执行的 binary 档案含有什么动态函式库。 2 步骤 2.1 Release版本 QtCreate使用Release版本编译 2.2 建文件夹并拷贝...
  • 网上有很多LinuxQT打包发布的方法,介绍比较多的是利用打包脚本(pack.sh)进行打包,以文章https://blog.csdn.net/qq_27350133/article/details/83445258为典型,介绍较为清晰,然而当我用这种方式打包发布后在...
  • window系统打包QT方法很多,用官方提供的windeployqt工具就可以,不过对应的版本要对。 linux 系统打包QT程序要稍稍复杂一点,一般有两种方式: 1.打包成二进制文件,2.打包成安装包形式 具体步骤如下: 1.将...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 5,942
精华内容 2,376
关键字:

linuxqt打包工具

linux 订阅