Skip to content

Instantly share code, notes, and snippets.

@J-Rios
Last active April 10, 2023 10:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save J-Rios/e4e6575624af2068c8927541213c5cd1 to your computer and use it in GitHub Desktop.
Save J-Rios/e4e6575624af2068c8927541213c5cd1 to your computer and use it in GitHub Desktop.
Setup LinuxDeployQT in a Docker container. Instructions on how to prepare a Docker Container to use linuxdeployqt from an Ubuntu 18.04 host system through a Ubuntu 14.04 Docker container.

Setup LinuxDeployQT in a Docker container

  1. Install Docker:
wget https://raw.githubusercontent.com/J-Rios/BASH-Scripts/master/install/install_docker
sudo chmod +x install_docker
sudo ./install_docker
  1. Get Ubuntu 14.04 Docker base image:
sudo docker pull ubuntu:trusty
  1. Launch a container of the downloaded Ubuntu image:
sudo docker run -d --name dockerdeployqt -it ubuntu:trusty
  1. Enter the Container and get all required elements:
sudo docker exec -it dockerdeployqt bash
cd /root
apt-get update
apt-get -y install wget
apt-get -y install libglib2.0-0
  1. Install QT5:
wget https://raw.githubusercontent.com/J-Rios/BASH-Scripts/master/install/install_qt5
chmod +x install_qt5
./install_qt5
rm -f ./install_qt5
  1. Get and setup linuxdeployqt tool:
wget https://github.com/probonopd/linuxdeployqt/releases/download/6/linuxdeployqt-6-x86_64.AppImage
chmod +x linuxdeployqt-6-x86_64.AppImage
./linuxdeployqt-6-x86_64.AppImage --appimage-extract
mv squashfs-root deployqt
ln -s /root/deployqt/AppRun /usr/local/sbin/linuxdeployqt
rm -f linuxdeployqt-6-x86_64.AppImage
  1. Check that linuxdeployqt is working:
linuxdeployqt
  1. Exit the Container ad stop it (everything is ready to be used):
exit
sudo docker stop dockerdeployqt
@thebigG
Copy link

thebigG commented Jan 26, 2020

This is awesome, first off, thanks for making this. I tried my best, and couldn't get it to work. My host system is Ubuntu 18.04(Linux Mint) and set the Qt Target in Qt Creator to 5.9.5, which is the default for Ubuntu 18.04. When I package the app following the instructions in linuxdeployqt and then run the "AppRun" binary inside the 14.04 Ubuntu container, I get the following messages:

root@fa188903c1f5:~# ./AppRun ./AppRun: /usr/lib/x86_64-linux-gnu/libQt5Multimedia.so.5: no version information available (required by ./AppRun) ./AppRun: /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5: no version information available (required by ./AppRun) ./AppRun: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by ./AppRun) ./AppRun: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by ./AppRun) ./AppRun: /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5: no version information available (required by ./AppRun) ./AppRun: relocation error: ./AppRun: symbol qt_version_tag, version Qt_5.9 not defined in file libQt5Core.so.5 with link time reference

Any idea of how to fix it?

I ran qmake -v and this is the version I have inside the container:

QMake version 3.0 Using Qt version 5.2.1 in /usr/lib/x86_64-linux-gnu

Is this because I'm just not able to deploy the under Qt something written in Qt 5.9.5 to 5.2.1? Or is there another reason for this error?

Hope I was clear enough about my issue :)

@ratijas
Copy link

ratijas commented Jun 17, 2020

I have created a Dockerfile based on these instructions: https://gist.github.com/ratijas/f62ac36768d72d3a925ebfe114b0cd15

@ratijas
Copy link

ratijas commented Jun 17, 2020

Qt is very ancient on ubuntu:trusty. Need to find a way to install latest 5.15.

@thebigG
Copy link

thebigG commented Jun 17, 2020

I actually had solved the problem. But thanks so much for the docker file!

@akskumar31
Copy link

@thebigG I am having same problem, could you share the solution please. I am using Qt 5.15.

@thebigG
Copy link

thebigG commented Jul 6, 2020

Hi there @askumar31! I ended up not using linuxdeployqt. I used this-->https://github.com/AppImageCrafters/appimage-builder
I highly suggest you use it too; it is a very intuitive/easy-to-use implementation of AppImageKit.
They have a great tutorial right here-->https://appimage-builder.readthedocs.io/en/latest/intro/tutorial.html#what-s-next

I highly suggest taking your time and reading the tutorial--it helped me a ton!

I also wrote a script for my own project that makes building the AppImage a little easier if you are familiar with Qt's build system(qmake): https://github.com/thebigG/Tasker/blob/main/Tasker/build_AppImage.py

Hopefully you can get in there and change a few variables and use it for your own purposes!

Note that appimage-builder has support for testing on docker containers(you can easily test ALL linux distros with just a few command) and all of that good stuff!

I also highly recommend joining the IRC chat on here https://webchat.freenode.net/#AppImage

A lot of people(including me) hang out there a lot and are always willing to help!

Hopefully you find this somewhat helpful.
Cheers!

@Simran-B
Copy link

In case you want to run an AppImage in a Docker container where FUSE doesn't work unless you run it with --privileged (dangerous),
try the --appimage-extract-and-run option:

linuxdeployqt-continuous-x86_64.AppImage *.desktop -appimage --appimage-extract-and-run

Works on my end and is easier than to manually extract and run the deploy tool.

@GogoLike
Copy link

Create Dockerfile with Ubuntu 18.04

FROM ubuntu:18.04

RUN apt-get update && apt-get install -y
wget
qt5-default
gcc
g++
cmake

RUN wget https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage
&& chmod +x linuxdeployqt-*
&& ./linuxdeployqt-* --appimage-extract
&& mv squashfs-root deployqt
&& ln -s /deployqt/AppRun /usr/local/sbin/linuxdeployqt
&& rm -f linuxdeployqt-*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment