SlideShare a Scribd company logo
Copyright 2020, Burkhard Stubert
Build and Run Embedded Apps
Faster from QtCreator with Docker
Burkhard Stubert
As a solo consultant, I help teams succeed with Qt embedded systems
The Problem
2
App A v3.5 App A v1.0 App B v2.3 App C v4.7
Qt SDK
Yocto 2.7
Ubuntu 18.04
Qt SDK
Yocto 2.0
Ubuntu 14.04
Qt SDK
Yocto 2.4
Ubuntu 16.04
Qt SDK
Yocto 3.1
Ubuntu 19.10
Workstation
2x Xeon (32 cores)
Ubuntu 16.04
All Qt SDKs built in
Docker containers on
same workstation
How do we best build
Apps from QtCreator?
? ? ? ?
Solution 1 (Currently Used):
Virtual Machines
3
Host OS: Windows,
MacOS, Linux
App A v3.5
Qt SDK
Yocto 2.7
Guest OS:
Ubuntu 18.04
Host OS: Windows,
MacOS, Linux
App A v1.0
Qt SDK
Yocto 2.0
Guest OS:
Ubuntu 14.04
Host OS: Windows,
MacOS, Linux
App B v2.3
Qt SDK
Yocto 2.4
Guest OS:
Ubuntu 16.04
Host OS: Windows,
MacOS, Linux
App C v4.7
Qt SDK
Yocto 3.1
Guest OS:
Ubuntu 19.10
2-3 VMs fit on same dev PC
Fast workstation and
existing containers
not used for app builds
VMs slower than containers
Solution 2 (This Talk):
Containers on Local Workstation
4
Workstation: Ubuntu 16.04
QtCreator
App A v3.5
Qt SDK
Yocto 2.7
Ubuntu 18.04
Container
QtCreator
App A v1.0
Qt SDK
Yocto 2.0
Ubuntu 14.04
Container
QtCreator
App B v2.3
Qt SDK
Yocto 2.4
Ubuntu 16.04
Container
QtCreator
App C v4.7
Qt SDK
Yocto 3.1
Ubuntu 19.10
Container
Build details hidden
in black box (container)
Reuse existing containers
on fast workstation
Solution 3 (Future):
Containers on Remote Workstation
5
Windows
QtCreator
App A v3.5
Linux
QtCreator
App A v1.0
Windows
QtCreator
App B v2.3
MacOS
QtCreator
App C v4.7
Workstation: Ubuntu 16.04
Qt SDK
Yocto 2.7
Ubuntu 18.04
Container
Qt SDK
Yocto 2.0
Ubuntu 14.04
Container
Qt SDK
Yocto 2.4
Ubuntu 16.04
Container
Qt SDK
Yocto 3.1
Ubuntu 19.10
Container
Apps developed on
different computers
Apps built in containers
on one or more
remote workstations
Copyright 2020, Burkhard Stubert
QtCreator-CMake-Docker
6
• Motivation
• Idea: Docker Wrapper for CMake
• Prerequisites
• General
• SSH Access to Device
• Building App with Docker
• Installing Qt SDK in Container
• Configuring QtCreator
• Building App with Docker-CMake
• Running App on Device
• Deployment and Run Settings
• Running App
Copyright 2020, Burkhard Stubert
How QtCreator Calls CMake (Native Build)
Stage Working Directory CMake Command
Configure
project
/tmp/QtCreator-YqhjyI/qtc-cmake-
MDHAJjOH => <work-dir-1>
cmake '-GUnix Makefiles' -C <work-dir-1>/qtcsettings.cmake
/public/Work/cuteradio-apps
Generate
build files
/public/Work/build-cuteradio-apps-
Desktop_Qt_5_14_2_GCC_64bit-
Debug => <work-dir-2>
cmake '-GUnix Makefiles' -C <work-dir-2>/qtcsettings.cmake
/public/Work/cuteradio-app
Compile <work-dir-2> cmake --build . --target all -- -j4
Install <work-dir-2> cmake --build . --target install
7
Call Docker wrapper
instead of cmake
Docker Wrapper for CMake
8
#!/bin/bash
args=$(echo $@ | sed -e "s|-GCodeBlocks - Unix Makefiles|'-
GCodeBlocks - Unix Makefiles'|g")
docker run --rm -v /public/Work:/public/Work -v /tmp:/tmp 
-w $(pwd) dr-yocto:sdk-18.04 cmake $args
Save script in
$HOME/bin/dr-cmake
Resurrect single quotes
removed by shell
/public/Work and /tmp
visible both on host PC
and in container
Copyright 2020, Burkhard Stubert
QtCreator-CMake-Docker
9
• Motivation
• Idea: Docker Wrapper for CMake
• Prerequisites
• General
• SSH Access to Device
• Building App with Docker
• Installing Qt SDK in Container
• Configuring QtCreator
• Building App with Docker-CMake
• Running App on Device
• Deployment and Run Settings
• Running App
My Setup
10
Workstation: Ubuntu 16.04
QtCreator
Cuteradio App
Qt SDK for RPi 3
Yocto 2.6
Ubuntu 18.04
Container
Only a proof of concept!
Copyright 2020, Burkhard Stubert
Prerequisites: General
• Install Docker on workstation (see [2])
• Create a Docker container (sdk-18.04) for Yocto builds (see [3])
• Build a Linux image with the Docker container (see [3])
• Or: Use a pre-built Boot2Qt image from The Qt Company (see [5] and [6])
• Build Qt SDK with the Docker container (see [4])
• Or: Use a pre-built Boot2Qt SDK from The Qt Company (see [5] and [6])
• Establish SSH connection between workstation and device (see [1] and [4])
11
Copyright 2020, Burkhard Stubert
QtCreator-CMake-Docker
12
• Motivation
• Idea: Docker Wrapper for CMake
• Prerequisites
• General
• SSH Access to Device
• Building App with Docker
• Installing Qt SDK in Container
• Configuring QtCreator
• Building App with Docker-CMake
• Running App on Device
• Deployment and Run Settings
• Running App
Prerequisites: SSH Access to Device
13
See [1] and [4]
how to add device
Copyright 2020, Burkhard Stubert
QtCreator-CMake-Docker
14
• Motivation
• Idea: Docker Wrapper for CMake
• Prerequisites
• General
• SSH Access to Device
• Building App with Docker
• Installing Qt SDK in Container
• Configuring QtCreator
• Building App with Docker-CMake
• Running App on Device
• Deployment and Run Settings
• Running App
Installing Qt SDK in Container
15
$ cd /public/Work
$ docker run –t –rm –v /public/Work:/public/Work -v /tmp:/tmp 
-w $(pwd) dr-yocto:sdk-18.04
On Workstation:
# cd cuteradio-thud/build-rpi3/tmp/deploy/sdk/
# ./poky-glibc-x86_64-meta-toolchain-qt5-cortexa7t2hf-neon-vfpv4-
toolchain-2.6.4.sh
Poky (Yocto Project Reference Distro) SDK installer version 2.6.4
=================================================================
Enter target directory for SDK (default: /opt/poky/2.6.4):
/public/Work/qt-sdk-thud
...
In Docker container:
Setting Up Build Environment in Dockerfile
16
export OECORE_NATIVE_SYSROOT="/public/Work/qt-sdk-thud/sysroots/x86_64-pokysdk-linux"
export OECORE_TARGET_SYSROOT="$SDKTARGETSYSROOT"
export OECORE_BASELIB="lib"
export OECORE_TARGET_ARCH="arm"
export OECORE_TARGET_OS="linux-gnueabi"
...
ENV OECORE_NATIVE_SYSROOT="/public/Work/qt-sdk-thud/sysroots/x86_64-pokysdk-linux"
ENV OECORE_TARGET_SYSROOT="${SDKTARGETSYSROOT}"
ENV OECORE_BASELIB="lib"
ENV OECORE_TARGET_ARCH="arm"
ENV OECORE_TARGET_OS="linux-gnueabi"
...
source environment-setup-cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi
Dockerfile
Change all environment variables
Fixing Environment Variables for QtCreator
17
export CC="arm-poky-linux-gnueabi-gcc -march=armv7ve -mthumb -mfpu=neon-vfpv4 -
mfloat-abi=hard -mcpu=cortex-a7 --sysroot=$SDKTARGETSYSROOT"
export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types "
export CXX="arm-poky-linux-gnueabi-g++ -march=armv7ve -mthumb -mfpu=neon-vfpv4 -
mfloat-abi=hard -mcpu=cortex-a7 --sysroot=$SDKTARGETSYSROOT"
export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types "
ENV CC="arm-poky-linux-gnueabi-gcc"
ENV CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -march=armv7ve -mthumb -
mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=${SDKTARGETSYSROOT}"
ENV CXX="arm-poky-linux-gnueabi-g++"
ENV CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -march=armv7ve -mthumb -
mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=${SDKTARGETSYSROOT}"
Do same with LD/LDFLAGS
and CPP/CPPFLAGS
Move options from CC to CFLAGS
and from CXX to CXXFLAGS
Copyright 2020, Burkhard Stubert
QtCreator-CMake-Docker
18
• Motivation
• Idea: Docker Wrapper for CMake
• Prerequisites
• General
• SSH Access to Device
• Building App with Docker
• Installing Qt SDK in Container
• Configuring QtCreator
• Building App with Docker-CMake
• Running App on Device
• Deployment and Run Settings
• Running App
Configuring QtCreator: CMake
19
Configuring QtCreator: Kit
20
Configuring QtCreator:
Kit – CMake Generator
21
Configuring QtCreator:
Kit – CMake Configuration
22
Copyright 2020, Burkhard Stubert
QtCreator-CMake-Docker
23
• Motivation
• Idea: Docker Wrapper for CMake
• Prerequisites
• General
• SSH Access to Device
• Building App with Docker
• Installing Qt SDK in Container
• Configuring QtCreator
• Building App with Docker-CMake
• Running App on Device
• Deployment and Run Settings
• Running App
Building the App with dr-cmake:
Switching to Project "Docker Raspberry Pi"
24
Building the App with dr-cmake:
Output when Switching the Project
25
Building the App with dr-cmake:
CMake-Output of Switching to Project
26
15:50:29: Running steps for project cuteradio-apps...
15:50:30: Starting: "/home/burkhard/bin/dr-cmake" --build . --target all
[ 16%] Automatic MOC for target cuteradio
[ 16%] Built target cuteradio_autogen
[ 33%] Automatic RCC for qml.qrc
Scanning dependencies of target cuteradio
[ 50%] Building CXX object
CMakeFiles/cuteradio.dir/cuteradio_autogen/mocs_compilation.cpp.o
[ 66%] Building CXX object CMakeFiles/cuteradio.dir/main.cpp.o
[ 83%] Building CXX object
CMakeFiles/cuteradio.dir/cuteradio_autogen/EWIEGA46WW/qrc_qml.cpp.o
[100%] Linking CXX executable cuteradio
[100%] Built target cuteradio
15:50:33: The process "/home/burkhard/bin/dr-cmake" exited normally.
15:50:33: Elapsed time: 00:05.
Copyright 2020, Burkhard Stubert
QtCreator-CMake-Docker
27
• Motivation
• Idea: Docker Wrapper for CMake
• Prerequisites
• General
• SSH Access to Device
• Building App with Docker
• Installing Qt SDK in Container
• Configuring QtCreator
• Building App with Docker-CMake
• Running App on Device
• Deployment and Run Settings
• Running App
Deployment Settings
28
Run Settings
29
Copyright 2020, Burkhard Stubert
QtCreator-CMake-Docker
30
• Motivation
• Idea: Docker Wrapper for CMake
• Prerequisites
• General
• SSH Access to Device
• Building App with Docker
• Installing Qt SDK in Container
• Configuring QtCreator
• Building App with Docker-CMake
• Running App on Device
• Deployment and Run Settings
• Running App
Running App on Device: Compile Output
31
Running App on Device: Application Output
32
Copyright 2020, Burkhard Stubert
Running App on Device: Instead of a Video
33
Ctrl+R
Copyright 2020, Burkhard Stubert
References
[1] Docker Builds from QtCreator. Basis for this talk.
[2] Using Docker Containers for Yocto Builds. How to install Docker.
[3] Qt Embedded Systems – Part 1: Building a Linux Image with Yocto. First step
to create a Qt SDK.
[4] Qt Embedded Systems – Part 2: Building a Qt SDK with Yocto. Creates the Qt
SDK used in this talk.
[5] The Qt Company, Boot to Qt Software Stack. Official documentation of
Boot2Qt.
[6] Tino Pyssysalo, Getting Started with Yocto & eLinux. How to install a Qt SDK
and start developing an app.
34
This presentation is licensed under a Creative Commons
Attribution-ShareAlike 4.0 International License.
Copyright 2020, Burkhard Stubert
Thank you 
Mail: burkhard.stubert@embeddeduse.com
Web: http://www.embeddeduse.com

More Related Content

PDF
Build and run embedded apps faster from qt creator with docker
 
PDF
Using Qt under LGPLv3
PPTX
Hexagonal Architecture: The Standard for Qt Embedded Applications
PDF
A Deep Dive into QtCanBus
PDF
eStargzイメージとlazy pullingによる高速なコンテナ起動
PPTX
Java applications containerized and deployed
PDF
containerdの概要と最近の機能
PDF
Daneyon Hansen - Intro to OpenStack - Feb13 OpenStack Denver Meetup
Build and run embedded apps faster from qt creator with docker
 
Using Qt under LGPLv3
Hexagonal Architecture: The Standard for Qt Embedded Applications
A Deep Dive into QtCanBus
eStargzイメージとlazy pullingによる高速なコンテナ起動
Java applications containerized and deployed
containerdの概要と最近の機能
Daneyon Hansen - Intro to OpenStack - Feb13 OpenStack Denver Meetup

What's hot (20)

PDF
Kubernetes for Java developers
PDF
【CNDO2021】Calicoのデプロイをミスって本番クラスタを壊しそうになった話
PDF
[KubeCon EU 2020] containerd Deep Dive
PPTX
2013 09-02 senzations-bimschas-part4-setting-up-your-own-testbed
PPTX
2013 09-02 senzations-bimschas-part2-smart-santander-experimentation
PDF
Introduction and Deep Dive Into Containerd
PDF
Raspberry Pi Swarm Cluster
PPTX
2013 09-02 senzations-bimschas-part3-wiselib
PDF
BuildKitでLazy Pullを有効にしてビルドを早くする話
PDF
WISEBED Tutorial @ ADHOCNETS 2011
PDF
Kernel Recipes 2019 - Driving the industry toward upstream first
PDF
The overview of lazypull with containerd Remote Snapshotter & Stargz Snapshotter
PDF
PL-4051, An Introduction to SPIR for OpenCL Application Developers and Compil...
PDF
Docker, Docker Swarm mangement tool - Gorae
PDF
Reaching the multimedia web from embedded platforms with WPEWebkit
PDF
Optimizing NN inference performance on Arm NEON and Vulkan
PDF
JDD2014: Docker.io - versioned linux containers for JVM devops - Dominik Dorn
PDF
Multimedia support in WebKitGTK and WPE, current status and plans (GStreamer ...
PDF
Андрей Володин — Как подружиться с роботом
Kubernetes for Java developers
【CNDO2021】Calicoのデプロイをミスって本番クラスタを壊しそうになった話
[KubeCon EU 2020] containerd Deep Dive
2013 09-02 senzations-bimschas-part4-setting-up-your-own-testbed
2013 09-02 senzations-bimschas-part2-smart-santander-experimentation
Introduction and Deep Dive Into Containerd
Raspberry Pi Swarm Cluster
2013 09-02 senzations-bimschas-part3-wiselib
BuildKitでLazy Pullを有効にしてビルドを早くする話
WISEBED Tutorial @ ADHOCNETS 2011
Kernel Recipes 2019 - Driving the industry toward upstream first
The overview of lazypull with containerd Remote Snapshotter & Stargz Snapshotter
PL-4051, An Introduction to SPIR for OpenCL Application Developers and Compil...
Docker, Docker Swarm mangement tool - Gorae
Reaching the multimedia web from embedded platforms with WPEWebkit
Optimizing NN inference performance on Arm NEON and Vulkan
JDD2014: Docker.io - versioned linux containers for JVM devops - Dominik Dorn
Multimedia support in WebKitGTK and WPE, current status and plans (GStreamer ...
Андрей Володин — Как подружиться с роботом
Ad

Similar to Webinar: Building Embedded Applications from QtCreator with Docker (20)

PDF
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
PDF
Basicsof c make and git for a hello qt application
PDF
Fast C++ Web Servers
PDF
Developing WebKitGTK Made Easy: wkdev-sdk
PDF
An Introduction to CMake
 
PDF
cmake.pdf
PDF
CMake: Improving Software Quality and Process
PDF
Basic Cmake for Qt Users
 
PDF
Qtws19 how-to-build-qml-app-for-webos
PPTX
Настройка окружения для кросскомпиляции проектов на основе docker'a
PDF
Getting started with open mobile development on the Openmoko platform
PPT
Qt native built for raspberry zero
PDF
An Introduction to the Yocto Embedded Framework 2018
 
PDF
Cmake kitware
PDF
Build your own embedded linux distributions by yocto project
PDF
CMake_Tutorial.pdf
PDF
How to create your own Linux distribution (embedded-gothenburg)
PDF
Intel® Curie™ Open Developer Kit (ODK): A Primer—Part 1
PDF
CMake best practices
PDF
yocto_scale_handout-with-notes
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
Basicsof c make and git for a hello qt application
Fast C++ Web Servers
Developing WebKitGTK Made Easy: wkdev-sdk
An Introduction to CMake
 
cmake.pdf
CMake: Improving Software Quality and Process
Basic Cmake for Qt Users
 
Qtws19 how-to-build-qml-app-for-webos
Настройка окружения для кросскомпиляции проектов на основе docker'a
Getting started with open mobile development on the Openmoko platform
Qt native built for raspberry zero
An Introduction to the Yocto Embedded Framework 2018
 
Cmake kitware
Build your own embedded linux distributions by yocto project
CMake_Tutorial.pdf
How to create your own Linux distribution (embedded-gothenburg)
Intel® Curie™ Open Developer Kit (ODK): A Primer—Part 1
CMake best practices
yocto_scale_handout-with-notes
Ad

Recently uploaded (20)

PDF
Hybrid model detection and classification of lung cancer
PPTX
A Presentation on Artificial Intelligence
PDF
Mushroom cultivation and it's methods.pdf
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Web App vs Mobile App What Should You Build First.pdf
PDF
DP Operators-handbook-extract for the Mautical Institute
PPTX
1. Introduction to Computer Programming.pptx
PDF
Getting Started with Data Integration: FME Form 101
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
project resource management chapter-09.pdf
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
Hybrid model detection and classification of lung cancer
A Presentation on Artificial Intelligence
Mushroom cultivation and it's methods.pdf
Group 1 Presentation -Planning and Decision Making .pptx
Web App vs Mobile App What Should You Build First.pdf
DP Operators-handbook-extract for the Mautical Institute
1. Introduction to Computer Programming.pptx
Getting Started with Data Integration: FME Form 101
A novel scalable deep ensemble learning framework for big data classification...
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Unlocking AI with Model Context Protocol (MCP)
Enhancing emotion recognition model for a student engagement use case through...
project resource management chapter-09.pdf
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
MIND Revenue Release Quarter 2 2025 Press Release
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
cloud_computing_Infrastucture_as_cloud_p
Univ-Connecticut-ChatGPT-Presentaion.pdf

Webinar: Building Embedded Applications from QtCreator with Docker

  • 1. Copyright 2020, Burkhard Stubert Build and Run Embedded Apps Faster from QtCreator with Docker Burkhard Stubert As a solo consultant, I help teams succeed with Qt embedded systems
  • 2. The Problem 2 App A v3.5 App A v1.0 App B v2.3 App C v4.7 Qt SDK Yocto 2.7 Ubuntu 18.04 Qt SDK Yocto 2.0 Ubuntu 14.04 Qt SDK Yocto 2.4 Ubuntu 16.04 Qt SDK Yocto 3.1 Ubuntu 19.10 Workstation 2x Xeon (32 cores) Ubuntu 16.04 All Qt SDKs built in Docker containers on same workstation How do we best build Apps from QtCreator? ? ? ? ?
  • 3. Solution 1 (Currently Used): Virtual Machines 3 Host OS: Windows, MacOS, Linux App A v3.5 Qt SDK Yocto 2.7 Guest OS: Ubuntu 18.04 Host OS: Windows, MacOS, Linux App A v1.0 Qt SDK Yocto 2.0 Guest OS: Ubuntu 14.04 Host OS: Windows, MacOS, Linux App B v2.3 Qt SDK Yocto 2.4 Guest OS: Ubuntu 16.04 Host OS: Windows, MacOS, Linux App C v4.7 Qt SDK Yocto 3.1 Guest OS: Ubuntu 19.10 2-3 VMs fit on same dev PC Fast workstation and existing containers not used for app builds VMs slower than containers
  • 4. Solution 2 (This Talk): Containers on Local Workstation 4 Workstation: Ubuntu 16.04 QtCreator App A v3.5 Qt SDK Yocto 2.7 Ubuntu 18.04 Container QtCreator App A v1.0 Qt SDK Yocto 2.0 Ubuntu 14.04 Container QtCreator App B v2.3 Qt SDK Yocto 2.4 Ubuntu 16.04 Container QtCreator App C v4.7 Qt SDK Yocto 3.1 Ubuntu 19.10 Container Build details hidden in black box (container) Reuse existing containers on fast workstation
  • 5. Solution 3 (Future): Containers on Remote Workstation 5 Windows QtCreator App A v3.5 Linux QtCreator App A v1.0 Windows QtCreator App B v2.3 MacOS QtCreator App C v4.7 Workstation: Ubuntu 16.04 Qt SDK Yocto 2.7 Ubuntu 18.04 Container Qt SDK Yocto 2.0 Ubuntu 14.04 Container Qt SDK Yocto 2.4 Ubuntu 16.04 Container Qt SDK Yocto 3.1 Ubuntu 19.10 Container Apps developed on different computers Apps built in containers on one or more remote workstations
  • 6. Copyright 2020, Burkhard Stubert QtCreator-CMake-Docker 6 • Motivation • Idea: Docker Wrapper for CMake • Prerequisites • General • SSH Access to Device • Building App with Docker • Installing Qt SDK in Container • Configuring QtCreator • Building App with Docker-CMake • Running App on Device • Deployment and Run Settings • Running App
  • 7. Copyright 2020, Burkhard Stubert How QtCreator Calls CMake (Native Build) Stage Working Directory CMake Command Configure project /tmp/QtCreator-YqhjyI/qtc-cmake- MDHAJjOH => <work-dir-1> cmake '-GUnix Makefiles' -C <work-dir-1>/qtcsettings.cmake /public/Work/cuteradio-apps Generate build files /public/Work/build-cuteradio-apps- Desktop_Qt_5_14_2_GCC_64bit- Debug => <work-dir-2> cmake '-GUnix Makefiles' -C <work-dir-2>/qtcsettings.cmake /public/Work/cuteradio-app Compile <work-dir-2> cmake --build . --target all -- -j4 Install <work-dir-2> cmake --build . --target install 7 Call Docker wrapper instead of cmake
  • 8. Docker Wrapper for CMake 8 #!/bin/bash args=$(echo $@ | sed -e "s|-GCodeBlocks - Unix Makefiles|'- GCodeBlocks - Unix Makefiles'|g") docker run --rm -v /public/Work:/public/Work -v /tmp:/tmp -w $(pwd) dr-yocto:sdk-18.04 cmake $args Save script in $HOME/bin/dr-cmake Resurrect single quotes removed by shell /public/Work and /tmp visible both on host PC and in container
  • 9. Copyright 2020, Burkhard Stubert QtCreator-CMake-Docker 9 • Motivation • Idea: Docker Wrapper for CMake • Prerequisites • General • SSH Access to Device • Building App with Docker • Installing Qt SDK in Container • Configuring QtCreator • Building App with Docker-CMake • Running App on Device • Deployment and Run Settings • Running App
  • 10. My Setup 10 Workstation: Ubuntu 16.04 QtCreator Cuteradio App Qt SDK for RPi 3 Yocto 2.6 Ubuntu 18.04 Container Only a proof of concept!
  • 11. Copyright 2020, Burkhard Stubert Prerequisites: General • Install Docker on workstation (see [2]) • Create a Docker container (sdk-18.04) for Yocto builds (see [3]) • Build a Linux image with the Docker container (see [3]) • Or: Use a pre-built Boot2Qt image from The Qt Company (see [5] and [6]) • Build Qt SDK with the Docker container (see [4]) • Or: Use a pre-built Boot2Qt SDK from The Qt Company (see [5] and [6]) • Establish SSH connection between workstation and device (see [1] and [4]) 11
  • 12. Copyright 2020, Burkhard Stubert QtCreator-CMake-Docker 12 • Motivation • Idea: Docker Wrapper for CMake • Prerequisites • General • SSH Access to Device • Building App with Docker • Installing Qt SDK in Container • Configuring QtCreator • Building App with Docker-CMake • Running App on Device • Deployment and Run Settings • Running App
  • 13. Prerequisites: SSH Access to Device 13 See [1] and [4] how to add device
  • 14. Copyright 2020, Burkhard Stubert QtCreator-CMake-Docker 14 • Motivation • Idea: Docker Wrapper for CMake • Prerequisites • General • SSH Access to Device • Building App with Docker • Installing Qt SDK in Container • Configuring QtCreator • Building App with Docker-CMake • Running App on Device • Deployment and Run Settings • Running App
  • 15. Installing Qt SDK in Container 15 $ cd /public/Work $ docker run –t –rm –v /public/Work:/public/Work -v /tmp:/tmp -w $(pwd) dr-yocto:sdk-18.04 On Workstation: # cd cuteradio-thud/build-rpi3/tmp/deploy/sdk/ # ./poky-glibc-x86_64-meta-toolchain-qt5-cortexa7t2hf-neon-vfpv4- toolchain-2.6.4.sh Poky (Yocto Project Reference Distro) SDK installer version 2.6.4 ================================================================= Enter target directory for SDK (default: /opt/poky/2.6.4): /public/Work/qt-sdk-thud ... In Docker container:
  • 16. Setting Up Build Environment in Dockerfile 16 export OECORE_NATIVE_SYSROOT="/public/Work/qt-sdk-thud/sysroots/x86_64-pokysdk-linux" export OECORE_TARGET_SYSROOT="$SDKTARGETSYSROOT" export OECORE_BASELIB="lib" export OECORE_TARGET_ARCH="arm" export OECORE_TARGET_OS="linux-gnueabi" ... ENV OECORE_NATIVE_SYSROOT="/public/Work/qt-sdk-thud/sysroots/x86_64-pokysdk-linux" ENV OECORE_TARGET_SYSROOT="${SDKTARGETSYSROOT}" ENV OECORE_BASELIB="lib" ENV OECORE_TARGET_ARCH="arm" ENV OECORE_TARGET_OS="linux-gnueabi" ... source environment-setup-cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi Dockerfile Change all environment variables
  • 17. Fixing Environment Variables for QtCreator 17 export CC="arm-poky-linux-gnueabi-gcc -march=armv7ve -mthumb -mfpu=neon-vfpv4 - mfloat-abi=hard -mcpu=cortex-a7 --sysroot=$SDKTARGETSYSROOT" export CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types " export CXX="arm-poky-linux-gnueabi-g++ -march=armv7ve -mthumb -mfpu=neon-vfpv4 - mfloat-abi=hard -mcpu=cortex-a7 --sysroot=$SDKTARGETSYSROOT" export CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types " ENV CC="arm-poky-linux-gnueabi-gcc" ENV CFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -march=armv7ve -mthumb - mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=${SDKTARGETSYSROOT}" ENV CXX="arm-poky-linux-gnueabi-g++" ENV CXXFLAGS=" -O2 -pipe -g -feliminate-unused-debug-types -march=armv7ve -mthumb - mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=${SDKTARGETSYSROOT}" Do same with LD/LDFLAGS and CPP/CPPFLAGS Move options from CC to CFLAGS and from CXX to CXXFLAGS
  • 18. Copyright 2020, Burkhard Stubert QtCreator-CMake-Docker 18 • Motivation • Idea: Docker Wrapper for CMake • Prerequisites • General • SSH Access to Device • Building App with Docker • Installing Qt SDK in Container • Configuring QtCreator • Building App with Docker-CMake • Running App on Device • Deployment and Run Settings • Running App
  • 21. Configuring QtCreator: Kit – CMake Generator 21
  • 22. Configuring QtCreator: Kit – CMake Configuration 22
  • 23. Copyright 2020, Burkhard Stubert QtCreator-CMake-Docker 23 • Motivation • Idea: Docker Wrapper for CMake • Prerequisites • General • SSH Access to Device • Building App with Docker • Installing Qt SDK in Container • Configuring QtCreator • Building App with Docker-CMake • Running App on Device • Deployment and Run Settings • Running App
  • 24. Building the App with dr-cmake: Switching to Project "Docker Raspberry Pi" 24
  • 25. Building the App with dr-cmake: Output when Switching the Project 25
  • 26. Building the App with dr-cmake: CMake-Output of Switching to Project 26 15:50:29: Running steps for project cuteradio-apps... 15:50:30: Starting: "/home/burkhard/bin/dr-cmake" --build . --target all [ 16%] Automatic MOC for target cuteradio [ 16%] Built target cuteradio_autogen [ 33%] Automatic RCC for qml.qrc Scanning dependencies of target cuteradio [ 50%] Building CXX object CMakeFiles/cuteradio.dir/cuteradio_autogen/mocs_compilation.cpp.o [ 66%] Building CXX object CMakeFiles/cuteradio.dir/main.cpp.o [ 83%] Building CXX object CMakeFiles/cuteradio.dir/cuteradio_autogen/EWIEGA46WW/qrc_qml.cpp.o [100%] Linking CXX executable cuteradio [100%] Built target cuteradio 15:50:33: The process "/home/burkhard/bin/dr-cmake" exited normally. 15:50:33: Elapsed time: 00:05.
  • 27. Copyright 2020, Burkhard Stubert QtCreator-CMake-Docker 27 • Motivation • Idea: Docker Wrapper for CMake • Prerequisites • General • SSH Access to Device • Building App with Docker • Installing Qt SDK in Container • Configuring QtCreator • Building App with Docker-CMake • Running App on Device • Deployment and Run Settings • Running App
  • 30. Copyright 2020, Burkhard Stubert QtCreator-CMake-Docker 30 • Motivation • Idea: Docker Wrapper for CMake • Prerequisites • General • SSH Access to Device • Building App with Docker • Installing Qt SDK in Container • Configuring QtCreator • Building App with Docker-CMake • Running App on Device • Deployment and Run Settings • Running App
  • 31. Running App on Device: Compile Output 31
  • 32. Running App on Device: Application Output 32
  • 33. Copyright 2020, Burkhard Stubert Running App on Device: Instead of a Video 33 Ctrl+R
  • 34. Copyright 2020, Burkhard Stubert References [1] Docker Builds from QtCreator. Basis for this talk. [2] Using Docker Containers for Yocto Builds. How to install Docker. [3] Qt Embedded Systems – Part 1: Building a Linux Image with Yocto. First step to create a Qt SDK. [4] Qt Embedded Systems – Part 2: Building a Qt SDK with Yocto. Creates the Qt SDK used in this talk. [5] The Qt Company, Boot to Qt Software Stack. Official documentation of Boot2Qt. [6] Tino Pyssysalo, Getting Started with Yocto & eLinux. How to install a Qt SDK and start developing an app. 34
  • 35. This presentation is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Copyright 2020, Burkhard Stubert Thank you  Mail: burkhard.stubert@embeddeduse.com Web: http://www.embeddeduse.com

Editor's Notes

  • #3: If Ubuntu version newer than Yocto version, Yocto builds fail with strange errors. Ubuntu versions can also be too old so that newer Yocto versions don't build on them. App developers work on different Ubuntu versions for many good reasons. Embedded systems have life times of 10, 15 or even 20 years. As the manufacturer, you must guarantee that systems work that long.
  • #4: You can run VMs (basically) everywhere: on laptop, dev PC, workstation. Build times for my current project: ~5 minutes in VM on Macbook Pro, 20 seconds natively on workstation. Longer build times sum up. Easily 1-2 days per month per team (3 developers).
  • #5: All containers have the same interface!!! They are black boxes for QtCreator Reuses existing containers on fast workstation
  • #6: This is what you do with builds of Linux images and Qt SDKs already – and for release builds. CLion seems to support these remote builds.
  • #8: The cmake calls are the interface to the Docker containers. They are the same for all containers. The work directories /tmp and /public/Work must be visible in host PC and in Docker container.
  • #18: QtCreator only passes the binary of the C and C++ compiler (without any options) to CMake. This lets the compiler test fail, because the test binary doesn't have the right floating-point support. QtCreator expects all compiler flags in the CFLAGS and CXXFLAGs and ignores options contained in CC and CXX.
  • #26: Hit Ctrl+B