Search by Tags

Qt Debian Container for Torizon

 

Article updated at 17 Feb 2021
Compare with Revision




Subscribe for this article updates

Select the version of your OS from the tabs below. If you don't know the version you are using, run the command cat /etc/os-release or cat /etc/issue on the board.



Remember that you can always refer to the Torizon Documentation, there you can find a lot of relevant articles that might help you in the application development.

Torizon 5.0.0

Introduction

Toradex provides Qt containers with the base Qt5 libraries installed. It makes it easy for you to extend this container with your application and its dependencies. See some advantages of using this container:

  • You can keep applications independent
  • Use different runtimes
  • Encapsulate application dependencies in the container
  • It will be easier to maintain

The following containers from Toradex are available:

  • qt5-wayland: minimal container with Qt5 libraries. You should use it as the base for deploying your own app.
  • qt5-wayland-examples: built on top of qt5-wayland with qtbase5-examples and qtdeclarative5-examples. You can use it for a great out-of-the-box evaluation experience, as described in this article.

Visual Studio Code Extension for Torizon

While this article focuses on the command-line, you should consider using the Visual Studio Code Extension for Torizon for doing Qt C++ Application Development on Torizon or How to build a GUI with Qt for Python and TorizonCore, since it is meant to make your life easier.

If you have an existing Qt C++ application, read the articles Qt C++ Application Development on Torizon, which has a section about importing an existing application, and How to Import a C/C++ Application to Torizon.

This article complies to the Typographic Conventions for Torizon Documentation.

Prerequisites

The following prerequisites are proposed:

Executing the Containers

Run a Weston Container

Connect to the board terminal by establishing an SSH connection.

Start a Weston container which will be the graphics server. Choose your module from the tabs below and follow the instructions:

(Optional) pull the torizon/weston container image:

# docker pull torizon/weston:$CT_TAG_WESTON

Start the weston compositor:

# docker run -d --rm --name=weston --net=host --cap-add CAP_SYS_TTY_CONFIG \
             -v /dev:/dev -v /tmp:/tmp -v /run/udev/:/run/udev/ \
             --device-cgroup-rule='c 4:* rmw' --device-cgroup-rule='c 13:* rmw' \
             --device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' \
             torizon/weston:$CT_TAG_WESTON --developer weston-launch --tty=/dev/tty7 --user=torizon

(Optional) pull the torizon/weston container image:

# docker pull torizon/weston:$CT_TAG_WESTON

Start the weston compositor:

# docker run -d --rm --ipc=host --name=weston --net=host --cap-add CAP_SYS_TTY_CONFIG \
             -v /dev:/dev -v /tmp:/tmp -v /run/udev/:/run/udev/ \
             --device-cgroup-rule='c 4:* rmw' --device-cgroup-rule='c 13:* rmw' \
             --device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' \
             torizon/weston:$CT_TAG_WESTON --developer weston-launch \
             --tty=/dev/tty7 --user=torizon -- --use-pixman

(Optional) pull the torizon/weston-vivante container image:

# docker pull torizon/weston-vivante:$CT_TAG_WESTON_VIVANTE

Start the weston compositor:

Attention: Please, note that by executing the following line you are accepting the terms and conditions of the NXP's End-User License Agreement (EULA)

# docker run -e ACCEPT_FSL_EULA=1 -d --rm --name=weston --net=host --cap-add CAP_SYS_TTY_CONFIG \
             -v /dev:/dev -v /tmp:/tmp -v /run/udev/:/run/udev/ \
             --device-cgroup-rule='c 4:* rmw' --device-cgroup-rule='c 13:* rmw' \
             --device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' \
             torizon/weston-vivante:$CT_TAG_WESTON_VIVANTE --developer weston-launch \
             --tty=/dev/tty7 --user=torizon

Run a Qt Wayland Container

Start a Qt Wayland examples container. It works on top of Wayland, as explained in Debian Containers for Torizon, and has Qt libraries. When you package your own application, use the base instead of the examples image to save flash storage space.

Select your module from the tabs below and follow the instructions:

The following command brings up the Qt5 Wayland container with an interactive command prompt:

# docker run --rm -it --name=qt5 \
             -v /tmp:/tmp \
             -v /dev/dri:/dev/dri --device-cgroup-rule='c 226:* rmw' \
             torizon/qt5-wayland-examples:$CT_TAG_QT5_WAYLAND_EXAMPLES \
             bash

Use the Qt Quick 2D Renderer

Inside the Qt5 Wayland container, only if you are using a module without GPU (Colibri iMX7) and plan to also use Qt Quick, we recommend that you use the Qt Quick 2D Renderer, otherwise you may see a poor performance and high CPU load:

Warning: only export QMLSCENE_DEVICE=softwarecontext if your module does not have a GPU!

## export QMLSCENE_DEVICE=softwarecontext

Keep in mind that there are feature limitations when using the Qt Quick 2D Renderer.

Start a Qt Sample Application (32-bit SoCs)

Inside the Qt5 Wayland container, start any of the available Qt5 sample applications:

## /usr/lib/arm-linux-gnueabihf/qt5/examples/quick/animation/animation &

or

## /usr/lib/arm-linux-gnueabihf/qt5/examples/widgets/widgets/calculator/calculator &

or

## /usr/lib/arm-linux-gnueabihf/qt5/examples/widgets/widgets/shapedclock/shapedclock &

or

## /usr/lib/arm-linux-gnueabihf/qt5/examples/opengl/cube/cube &

The following command brings up the Qt5 Wayland container with an interactive command prompt:

# docker run --rm -it --name=qt5 \
             -v /tmp:/tmp \
             -v /dev/dri:/dev/dri --device-cgroup-rule='c 226:* rmw' \
             torizon/qt5-wayland-examples:$CT_TAG_QT5_WAYLAND_EXAMPLES \
             bash

Start a Qt Sample Application (64-bit SoCs with CPU only)

Inside the Qt5 Wayland container, start any of the available Qt5 sample applications:

## /usr/lib/aarch64-linux-gnu/qt5/examples/quick/animation/animation &

or

## /usr/lib/aarch64-linux-gnu/qt5/examples/widgets/widgets/calculator/calculator &

or

## /usr/lib/aarch64-linux-gnu/qt5/examples/widgets/widgets/shapedclock/shapedclock &

or

## /usr/lib/aarch64-linux-gnu/qt5/examples/opengl/cube/cube &

The following command brings up the Qt5 Wayland container with an interactive command prompt:

Attention: Please, note that by executing the following line you are accepting the terms and conditions of the NXP's End-User License Agreement (EULA)

docker run -e ACCEPT_FSL_EULA=1 --rm -it --name=qt5 \
           -v /tmp:/tmp \
           -v /dev/dri:/dev/dri -v /dev/galcore:/dev/galcore \
           --device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' \
           torizon/qt5-wayland-examples-vivante:$CT_TAG_QT5_WAYLAND_EXAMPLES_VIVANTE \
           bash

Start a Qt Sample Application (64-bit i.MX 8 SoCs with Vivante graphics acceleration)

Inside the Qt5 Wayland container, start any of the available Qt5 sample applications:

## /usr/lib/aarch64-linux-gnu/qt5/examples/quick/animation/animation &

or

## /usr/lib/aarch64-linux-gnu/qt5/examples/widgets/widgets/calculator/calculator &

or

## /usr/lib/aarch64-linux-gnu/qt5/examples/widgets/widgets/shapedclock/shapedclock &

or

## /usr/lib/aarch64-linux-gnu/qt5/examples/opengl/cube/cube &

Executing the QT5 Containers through Portainer

The image TorizonCore with evaluation containers has many different demos. For instructions about how to install Torizon on your board, refer to Toradex Quickstart Guide. In this image, the Weston container starts automatically after boot, therefore you do not need to start it.

With Portainer opened, explore the demos by going to the App Templates section in Portainer and click on the QT template and then click on Deploy The Container.


  • Available Container Examples in Portainer

    Available Container Examples in Portainer

This demo will execute the 3D Cube example. After creating and executing the container, you can edit the container to execute other demos. To do that, click on the Containers menu and select the qt5-app container


  • Containers menu

    Containers menu

On the container's menu, click on the Duplicate/Edit button


  • Click on the Duplicate/Edit button

    Click on the Duplicate/Edit button

Edit the CMD field with the other demos' paths, as shown in the previous section, and click on the Deploy the Container button.


  • CMD Field

    CMD Field

The demo will start as a new overlay in Weston.

More Information

Also, please watch the video session below for more information.

Torizon 4.0.0

Introduction

Toradex provides Qt containers with the base Qt5 libraries installed. It makes it easy for you to extend this container with your application and its dependencies. See some advantages of using this container:

  • You can keep applications independent
  • Use different runtimes
  • Encapsulate application dependencies in the container
  • It will be easier to maintain

The following containers from Toradex are available:

  • debian-qt5-wayland: minimal container with Qt5 libraries. You should use it as the base for deploying your own app.
  • debian-qt5-wayland-examples: built on top of debian-qt5-wayland with qtbase5-examples and qtdeclarative5-examples. You can use it for a great out-of-the-box evaluation experience, as described in this article.

This article complies to the Typographic Conventions for Torizon Documentation.

Prerequisites

The following prerequisites are proposed:

Executing the Containers

Attention: please use the tag buster-20200415 if you are using the TorizonCore Monthly release from April, a.k.a 4.0.0-devel-202004+build.3. At the moment you should only use the tag buster if you are using a newer release of TorizonCore.

Run a Weston Container

Connect to the board terminal by establishing an SSH connection.

Start a Weston container which will be the graphics server. Choose your module from the tabs below and follow the instructions:

Start weston using the torizon/arm32v7-debian-weston:buster container image:

# docker run -d --rm --name=weston --net=host --cap-add CAP_SYS_TTY_CONFIG \
             -v /dev:/dev -v /tmp:/tmp -v /run/udev/:/run/udev/ \
             --device-cgroup-rule='c 4:* rmw' --device-cgroup-rule='c 13:* rmw'  --device-cgroup-rule='c 226:* rmw'\
              torizon/arm32v7-debian-weston:buster --developer weston-launch --tty=/dev/tty7 --user=torizon

Start weston using the torizon/arm32v7-debian-weston:buster container image:

# docker run -d --rm --name=weston --net=host --cap-add CAP_SYS_TTY_CONFIG \
             -v /dev:/dev -v /tmp:/tmp -v /run/udev/:/run/udev/ \
             --device-cgroup-rule='c 4:* rmw'  --device-cgroup-rule='c 13:* rmw' --device-cgroup-rule='c 226:* rmw' \
              torizon/arm32v7-debian-weston:buster --developer weston-launch --tty=/dev/tty7 --user=torizon -- --use-pixman

Start weston using the torizon/arm64v8-debian-weston-vivante:buster container image:

Attention: Please, note that by executing the following line you are accepting the terms and conditions of the NXP's End-User License Agreement (EULA)

# docker run -e ACCEPT_FSL_EULA=1 -d --rm --name=weston --net=host --cap-add CAP_SYS_TTY_CONFIG \
             -v /dev:/dev -v /tmp:/tmp -v /run/udev/:/run/udev/ \
             --device-cgroup-rule='c 4:* rmw'  --device-cgroup-rule='c 13:* rmw' --device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' \
              torizon/arm64v8-debian-weston-vivante:buster --developer weston-launch --tty=/dev/tty7 --user=torizon

Run a Qt Wayland Container

Start a Qt Wayland examples container. It works on top of Wayland, as explained in Debian Containers for Torizon, and has Qt libraries. When you package your own application, use the base instead of the examples image to save flash storage space.

Select your module from the tabs below and follow the instructions:

Bring-up the Qt5 Wayland container:

# docker run --rm -it --name=qt5 \
             -v /tmp:/tmp \
             -v /dev/dri:/dev/dri --device-cgroup-rule='c 226:* rmw' \
             torizon/arm32v7-debian-qt5-wayland-examples:buster

Start a Qt Sample Application (32-bit SoCs)

Run any of the available applications to confirm that the Qt Wayland container is running successfully:

## /usr/lib/arm-linux-gnueabihf/qt5/examples/widgets/widgets/calculator/calculator &

or

## /usr/lib/arm-linux-gnueabihf/qt5/examples/widgets/widgets/shapedclock/shapedclock &

or

## /usr/lib/arm-linux-gnueabihf/qt5/examples/opengl/cube/cube &

Bring-up the Qt5 Wayland container:

# docker run --rm -it --name=qt5 \
             -v /tmp:/tmp \
             -v /dev/dri:/dev/dri --device-cgroup-rule='c 226:* rmw' \
             torizon/arm64v8-debian-qt5-wayland-examples:buster

Start a Qt Sample Application (64-bit SoCs with CPU only)

Run any of the available applications to confirm that the Qt Wayland container is running successfully:

## /usr/lib/aarch64-linux-gnu/qt5/examples/widgets/widgets/calculator/calculator &

or

## /usr/lib/aarch64-linux-gnu/qt5/examples/widgets/widgets/shapedclock/shapedclock &

or

## /usr/lib/aarch64-linux-gnu/qt5/examples/opengl/cube/cube &

Bring-up the Qt5 Wayland container:

Attention: Please, note that by executing the following line you are accepting the terms and conditions of the NXP's End-User License Agreement (EULA)

docker run -e ACCEPT_FSL_EULA=1 --rm -it --name=qt5 \
             -v /tmp:/tmp \
             -v /dev/dri:/dev/dri -v /dev/galcore:/dev/galcore \
             --device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' \
             torizon/arm64v8-debian-qt5-wayland-examples-vivante:buster

Start a Qt Sample Application (64-bit i.MX 8 SoCs with Vivante graphics acceleration)

Run any of the available applications to confirm that the Qt Wayland container is running successfully:

## /usr/lib/aarch64-linux-gnu/qt5/examples/widgets/widgets/calculator/calculator &

or

## /usr/lib/aarch64-linux-gnu/qt5/examples/widgets/widgets/shapedclock/shapedclock &

or

## /usr/lib/aarch64-linux-gnu/qt5/examples/opengl/cube/cube &

Also, please watch this video session for more information.