SlideShare a Scribd company logo
Build and run embedded apps faster from qt creator with docker
Build and run embedded apps faster from qt creator with docker
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 J
Mail: burkhard.stubert@embeddeduse.com
Web: http://www.embeddeduse.com

More Related Content

PPTX
Introduction Linux Device Drivers
PDF
Driving Down Automotive Costs for Richer HMIs with Qt & i.MX RT1170
 
PPTX
Bare Metal Cluster with Kubernetes, Istio and Metallb | Nguyen Phuong An, Ngu...
PDF
Git slides
PDF
Linux Preempt-RT Internals
PDF
Hands-On Introduction to Kubernetes at LISA17
PDF
Kubernetes Deployment Tutorial | Kubernetes Tutorial For Beginners | Kubernet...
PDF
Linux Internals - Part II
Introduction Linux Device Drivers
Driving Down Automotive Costs for Richer HMIs with Qt & i.MX RT1170
 
Bare Metal Cluster with Kubernetes, Istio and Metallb | Nguyen Phuong An, Ngu...
Git slides
Linux Preempt-RT Internals
Hands-On Introduction to Kubernetes at LISA17
Kubernetes Deployment Tutorial | Kubernetes Tutorial For Beginners | Kubernet...
Linux Internals - Part II

What's hot (20)

PDF
Introduction to container based virtualization with docker
PDF
Ruxcon 2014 - Stefan Esser - iOS8 Containers, Sandboxes and Entitlements
PDF
Introduction to Docker Containers - Docker Captain
PDF
Yocto project and open embedded training
PDF
USB Drivers
PPTX
Jenkins as a Service - Code all the way down
PDF
Docker 101 - from 0 to Docker in 30 minutes
PDF
Introduction to Kubernetes with demo
PDF
Marco Cavallini @ LinuxLab 2018 : Workshop Yocto Project, an automatic genera...
PPT
DevOps Pipeline for Liferay Application
PPTX
Prometheus design and philosophy
PDF
Embedded Recipes 2017 - Introduction to Yocto Project/OpenEmbedded - Mylène J...
PDF
Continuous Testing with Molecule, Ansible, and GitHub Actions
PDF
Introduction To Linux Kernel Modules
PDF
Zephyr: Creating a Best-of-Breed, Secure RTOS for IoT
PDF
Kubernetes Architecture and Introduction
ODP
Signature verification of kernel module and kexec
PDF
SUSE shim and things related to it
PDF
Sw update elce2017
Introduction to container based virtualization with docker
Ruxcon 2014 - Stefan Esser - iOS8 Containers, Sandboxes and Entitlements
Introduction to Docker Containers - Docker Captain
Yocto project and open embedded training
USB Drivers
Jenkins as a Service - Code all the way down
Docker 101 - from 0 to Docker in 30 minutes
Introduction to Kubernetes with demo
Marco Cavallini @ LinuxLab 2018 : Workshop Yocto Project, an automatic genera...
DevOps Pipeline for Liferay Application
Prometheus design and philosophy
Embedded Recipes 2017 - Introduction to Yocto Project/OpenEmbedded - Mylène J...
Continuous Testing with Molecule, Ansible, and GitHub Actions
Introduction To Linux Kernel Modules
Zephyr: Creating a Best-of-Breed, Secure RTOS for IoT
Kubernetes Architecture and Introduction
Signature verification of kernel module and kexec
SUSE shim and things related to it
Sw update elce2017
Ad

Similar to Build and run embedded apps faster from qt creator 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

More from Qt (20)

PPTX
Learn how to addressing medical and industrial challenges with BlackBerry QNX...
 
PPTX
Turn your product into a revenue machine with the new Qt Digital Advertising ...
 
PPTX
Modern microcontroller (mcu) application development with qt
 
PDF
Improve Time to Market for Industrial Edge Devices
 
PDF
How are Companies Overcoming the Global Chip Shortage
 
PPTX
Meet Qt 6.2 LTS - Ask Us Anything!
 
PDF
UI/UX Design Trends in Appliances
 
PPTX
Qt 6.2 lts vs. qt 5.15 the big feature parity comparison
 
PDF
Meet Qt Canada
 
PPTX
Machine learning meets embedded development
 
PDF
Companion App Design with Qt
 
PDF
Meet Qt 6.0
 
PDF
Qt Core UI, Live Forum
 
PDF
Top 10 User Interface Trends
 
PDF
Embracing Qt for Python
 
PPTX
10 PRINCIPAIS RAZÕES PARA TRABALHAR COM
 
PDF
How to create a medical device proof of-concept prototype overnight
 
PDF
Qt Software Development Framework - Medical
 
PDF
Qt Technology Overview for: MedAcuity
 
PDF
Webinar- Qt OPC UA - An Overview
 
Learn how to addressing medical and industrial challenges with BlackBerry QNX...
 
Turn your product into a revenue machine with the new Qt Digital Advertising ...
 
Modern microcontroller (mcu) application development with qt
 
Improve Time to Market for Industrial Edge Devices
 
How are Companies Overcoming the Global Chip Shortage
 
Meet Qt 6.2 LTS - Ask Us Anything!
 
UI/UX Design Trends in Appliances
 
Qt 6.2 lts vs. qt 5.15 the big feature parity comparison
 
Meet Qt Canada
 
Machine learning meets embedded development
 
Companion App Design with Qt
 
Meet Qt 6.0
 
Qt Core UI, Live Forum
 
Top 10 User Interface Trends
 
Embracing Qt for Python
 
10 PRINCIPAIS RAZÕES PARA TRABALHAR COM
 
How to create a medical device proof of-concept prototype overnight
 
Qt Software Development Framework - Medical
 
Qt Technology Overview for: MedAcuity
 
Webinar- Qt OPC UA - An Overview
 

Recently uploaded (20)

PPTX
Big Data Technologies - Introduction.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Encapsulation theory and applications.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Electronic commerce courselecture one. Pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
Big Data Technologies - Introduction.pptx
Programs and apps: productivity, graphics, security and other tools
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
NewMind AI Weekly Chronicles - August'25-Week II
Advanced methodologies resolving dimensionality complications for autism neur...
The Rise and Fall of 3GPP – Time for a Sabbatical?
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
A comparative analysis of optical character recognition models for extracting...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
MIND Revenue Release Quarter 2 2025 Press Release
Encapsulation theory and applications.pdf
Encapsulation_ Review paper, used for researhc scholars
MYSQL Presentation for SQL database connectivity
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Electronic commerce courselecture one. Pdf
The AUB Centre for AI in Media Proposal.docx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Unlocking AI with Model Context Protocol (MCP)

Build and run embedded apps faster from qt creator with docker

  • 3. 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
  • 4. 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? ? ? ? ?
  • 5. 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
  • 6. 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
  • 7. 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
  • 8. 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
  • 9. 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
  • 10. 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
  • 11. 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
  • 12. 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!
  • 13. 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
  • 14. 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
  • 15. Prerequisites: SSH Access to Device 13 See [1] and [4] how to add device
  • 16. 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
  • 17. 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:
  • 18. 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
  • 19. 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
  • 20. 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
  • 23. Configuring QtCreator: Kit – CMake Generator 21
  • 24. Configuring QtCreator: Kit – CMake Configuration 22
  • 25. 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
  • 26. Building the App with dr-cmake: Switching to Project "Docker Raspberry Pi" 24
  • 27. Building the App with dr-cmake: Output when Switching the Project 25
  • 28. 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.
  • 29. 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
  • 32. 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
  • 33. Running App on Device: Compile Output 31
  • 34. Running App on Device: Application Output 32
  • 35. Copyright 2020, Burkhard Stubert Running App on Device: Instead of a Video 33 Ctrl+R
  • 36. 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
  • 37. This presentation is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Copyright 2020, Burkhard Stubert Thank you J Mail: burkhard.stubert@embeddeduse.com Web: http://www.embeddeduse.com