probonopd
5a6172458e
|
8 years ago | |
---|---|---|
linuxdeployqt | 8 years ago | |
shared | 8 years ago | |
.gitignore | 8 years ago | |
.travis.yml | 8 years ago | |
LICENSE.GPLv3 | 8 years ago | |
LICENSE.LGPLv3 | 8 years ago | |
README.md | 8 years ago | |
linuxdeployqt.pro | 8 years ago |
README.md
linuxdeployqt
This Linux Deployment Tool for Qt, linuxdeployqt
, takes an application as input and makes it self-contained by copying in the Qt libraries and plugins that the application uses into a bundle. This can optionally be put into an AppImage.
Differences to macdeployqt
This tool is conceptually based on the Mac Deployment Tool, macdeployqt
in the tools applications of the Qt Toolkit, but has been changed to a slightly different logic and other tools needed for Linux.
- Instead of an
.app
bundle for macOS, this produces an AppDir for Linux - Instead of a
.dmg
disk image for macOS, this produces an AppImage for Linux which is quite similar to a dmg but executes the contained application rather than just opening a window on the desktop from where the application can be launched
Known issues
This may not be fully working yet. Use with care, run with maximum verbosity, submit issues and pull requests. Help is appreciated
Installation
-
If you believe in dogfeeding, download linuxdeployqt-x86_64.AppImage from the Releases page and
chmod a+x
it. Then you can skip the following steps because it is a self-contained bundle of linuxdeployqt (made with linuxdeployqt of course) -
Get and build linuxdeployqt e.g., using Qt 5.7.0 (you could use this Qt Creator AppImage for this)
sudo apt-get -y install git g++ libgl1-mesa-dev
git clone https://github.com/probonopd/linuxdeployqt.git
# Then build in Qt Creator, or use
export PATH=/tmp/.mount_QtCreator-5.7.0-x86_64/5.7/gcc_64/bin/:$PATH
cd linuxdeployqt
qmake linuxdeployqt.pro
make
- Build and install patchelf (a small utility to modify the dynamic linker and RPATH of ELF executables; similar to
install_name_tool
on macOS). To learn more about this, see http://blog.qt.io/blog/2011/10/28/rpath-and-runpath/
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 )
- Optional if you want to generate AppImages: Download AppImageAssistant and put it into your $PATH, e.g., into
/usr/local/bin
. Make sure it is renamed toAppImageAssistant
and ischmod a+x
wget https://github.com/probonopd/AppImageKit/releases/download/6/AppImageAssistant_6-x86_64.AppImage -O AppImageAssistant
chmod a+x AppImageAssistant
sudo mv AppImageAssistant /usr/local/bin/
Usage
Open in Qt Creator and build your application. Run it from the command line and inspect it with ldd
to make sure the correct libraries from the correct locations are getting loaded, as linuxdeployqt
will use ldd
internally to determine from where to copy libraries into the bundle.
Important: linuxdeployqt
deploys the Qt instance that qmake on the $PATH points to, so make sure that it is the correct one. Verify that qmake finds the correct Qt instance like this before running the linuxdeployqt
tool:
qmake -v
QMake version 3.0
Using Qt version 5.7.0 in /tmp/.mount_QtCreator-5.7.0-x86_64/5.7/gcc_64/lib
If this does not show the correct path to your Qt instance that you want to be bundled, then adjust your $PATH
to find the correct qmake
.
Usage: linuxdeployqt app-binary [options]
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
-libpath=<path> : Add the given path to the library search path
linuxdeployqt takes an application as input and makes it
self-contained by copying in the Qt libraries and plugins that
the application uses.
Contributing
These are my first steps with Qt and with C++ for that matter, and it is stil very young, so I'd appreciate your testing, comments, and (ideally) code review. Please discuss in the forum or using GitHub issues and pull requests.