Sign inSign up

theshadowx/rpi-qt

By theshadowx

Updated almost 11 years ago

Qt installed on Raspbian for Raspberry Pi

Image
2

190

theshadowx/rpi-qt repository overview

Description

A repository containing image of Raspbian having Qt installed for Raspberry Pi B+ / 2 This image is based on resin/rpi-raspbian:wheezy-2015-09-09

Here is how I built this image:

Raspbian base image
$ docker pull resin/rpi-raspbian:wheezy-2015-09-09
$ docker run -it /usr/bin/qemu-arm-static:/usr/bin/qemu-arm-static  resin/rpi-raspbian:wheezy-2015-09-09 bash
Modify sources.list

Open the file /etc/apt/sources.list comment the line by adding # And add the following :

deb http://archive.raspbian.org/raspbian wheezy main contrib non-free
deb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free

Save it and close it.

Add the key :

$ wget https://archive.raspbian.org/raspbian.public.key -O - | sudo apt-key add -
Install dependencies

Then update and install the repositories

$ apt-get update
$ apt-get install -y libfontconfig1-dev libdbus-1-dev libfreetype6-dev  \ 
libudev-dev libicu-dev libsqlite3-dev libxslt1-dev libssl-dev libasound2-dev \ 
libavcodec-dev libavformat-dev libswscale-dev libgstreamer0.10-dev \ 
libgstreamer-plugins-base0.10-dev gstreamer-tools gstreamer0.10-plugins-good \
gstreamer0.10-plugins-bad libraspberrypi-dev libpulse-dev libx11-dev \
libglib2.0-dev libcups2-dev freetds-dev libsqlite0-dev libpq-dev libiodbc2-dev \
libmysqlclient-dev firebird-dev libpng12-dev libjpeg62-dev libgst-dev \
libxext-dev libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 \
libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev \
libxcb-icccm4 libxcb-icccm4-dev libxcb-sync0 libxcb-sync0-dev libxcb-render-util0 \
libxcb-render-util0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev \
libxcb-randr0-dev libxcb-glx0-dev libxi-dev libdrm-dev glew-utils libglew-dev \
libmtdev-dev unixodbc libgles2-mesa-dev evtest tslib libts-bin wget
Qt

Get Qt from git repository

$ cd /opt
$ git clone git://code.qt.io/qt/qt5.git
$ cd qt5
$ git checkout 5.5
$ ./init-repository
Configure, Compile and Install
$ ./configure -v -opengl es2 -opensource -confirm-license -optimized-qmake -reduce-exports -release -nomake examples -qt-pcre -make libs -prefix /usr/local/qt5
$ make -j4
$ make install
Remove the sources :
$ cd /opt
$ rm -r qt5 
Add user

In the following we are going to add user (developer)

$ export uid=1000 gid=1000
$ mkdir -p /home/developer
$ echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd
$ echo "developer:x:${uid}:" >> /etc/group
$ echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer
$ chmod 0440 /etc/sudoers.d/developer
$ chown ${uid}:${gid} -R /home/developer
Run Qt application in Raspberry Pi

To run a Qt application in Raspberry Pi B+/2 with GUI, what you need to do is to bind the application executable to the container, and add DISPLAY to the environment (if your application uses peripherals you have to bind them too):

$ docker run -it --rm -e DISPLAY -v $HOME/.Xauthority:/home/developer/.Xauthority   -v /tmp/.X11-unix:/tmp/.X11-unix -v /usr/share/X11/xkb/:/usr/share/X11/xkb/  -v path/to/applicationExecutable:/data/applicationExecutable --net=host -u developer theshadowx/rpi-qt:wheezy_qt5.5 /data/applicationExecutable 
TroubleShooting

You may have a problem when you executing :

$ ./init-repository

The container may freeze, I have reported this issue in https://github.com/docker/docker/issues/16237 The workaround is that you do the git phase in the host and then bind the folder containing qt5 to a folder in the container when you execute run command.

$ docker run -it /usr/bin/qemu-arm-static:/usr/bin/qemu-arm-static -v /path/to/qt5:/data/qt5  resin/rpi-raspbian:wheezy-2015-09-09 bash
Copy

And inside the container copy qt5 folder to /opt

$ cp -r /data/qt5 /opt

Tag summary

Content type

Image

Digest

sha256:7c31162fa

Size

342.3 MB

Last updated

almost 11 years ago

docker pull theshadowx/rpi-qt:wheezy_qt5.5