Skip to content

Docker C++ Builder Image Update to v6.9.1

Reason

The current Docker image for building C++ projects is using Qt version 6.8.1 build at
Sat Feb 01 2025 17:21:06 GMT+0100 (Central European Standard Time).

To perform this update, I use my own sf-docker-runner repository from GitHub.

Actions to Take

The actions to take are described in a section of the 'README.md' in the repository which are in short:

Update Build Image

  1. Update the base image.
  2. Push the base image to our own registry.
  3. Build the C++ builder image without Qt-library.
  4. Push the C++ builder image without Qt-library.

This is both done for Linux architectures x86_64 and aarch64.

Build Latest Release of the Qt Library

After determine the latest release of the Qt library (currently is v6.9.1) with build-qt-lib.sh and command tags without cloning.
The build-qt-lib.sh script is modified to use the new tag which is in this case v6.9.1.

For Linux the Docker container is used but not for Windows.

The Qt library is build 3 times and stored in:

  1. Directory qt/lnx-x86_64/6.9.1 and build on Linux x86_64 using the x86_64 Docker container.
  2. Directory qt/lnx-aarch64/6.9.1 and bBuild on Linux x86_64 or RPi5 using the aarch64 Docker container.
  3. Directory qt/w64-x86_64/6.9.1 and build native on Windows.

For cross compiling Windows on Linux the directory qt/win-x86_64/6.9.1 is created using * overlayfs* from qt/w64-x86_64/6.9.1.
The qt-cross-windows-fix.sh modifies the qt/win-x86_64/6.9.1 files and more to replace the calls to tools as Qt MOC with the Linux versions using symbolic links to qt/lnx-x86_64/6.9.1.

./qt-cross-windows-fix.sh -r
# Add a specific version.
./qt-cross-windows-fix.sh -r --qt-ver 6.9.1
Response:

# Found Linux (x86_64) Qt highest version: '6.9.1'.
# Running for real...                                                                                                                                                                                                                                                              
Proposed directories:                                                                                                                                                                                                                                                              
Linux  : lnx-x86_64/6.9.1/gcc_64
Windows: win-x86_64/6.9.1/mingw_64

Modifying Windows Qt version 6.9.1 for Cross-compiling on Linux:                                                                                                                                                                                                                  
  Source     : lnx-x86_64/6.9.1/gcc_64/lib/cmake
  Destination: win-x86_64/6.9.1/mingw_64/lib/cmake
Continue [y/N]? 

Create the Final Docker Image including the Qt Library

To enable the Docker image to be used for 3 different OS'es the following is done. To create the image for compiling, testing and running pipelines for 'Linux x86_64', 'Linux aarch64' and 'Windows x86_64' three different Qt libraries are needed. The libraries are zipped and all mounted in a lib directory using fuse-zip.

To zip the libraries into the temporary directory, the following commands are used:

# Create file: /tmp/qt-lnx-x86_64-6.9.1.zip
./cpp-builder.sh --platform amd64 --qt-ver 6.9.1 qt-lnx
# Create file: /tmp/qt-lnx-aarch64-6.9.1.zip
./cpp-builder.sh --platform arm64 --qt-ver 6.9.1 qt-lnx
# Create file: /tmp/qt-win-x86_64-6.9.1.zip
./cpp-builder.sh --platform amd64 --qt-ver 6.9.1 qt-win

To be able to use the zip-files in the Docker image, they are uploaded to the Nexus server:

./cpp-builder.sh --platform amd64 --qt-ver 6.9.1 qt-lnx-up
./cpp-builder.sh --platform arm64 --qt-ver 6.9.1 qt-lnx-up
./cpp-builder.sh --platform amd64 --qt-ver 6.9.1 qt-win-up

Available Qt v6.9.1 libraries in Nexus:

Nexus Qt Libs

Now the final Docker image can be created, since the three Qt-libraries are available in Nexus.

./cpp-builder.sh --platform amd64 --qt-ver '6.9.1' build
# Push the image to the Nexus registry.
./cpp-builder.sh --platform amd64 --qt-ver '6.9.1' push

On the Raspberry Pi 5 the image is created the same way.

Using Docker for architecture aarch64 using qemu is very slow, so using Docker on a Raspberry Pi5 is recommended.

Images are now available in Nexus:

nexus-docker-registry.png

Push the amd64 image also to the Docker Hub registry for public sharing.

# Login to Docker Hub using the credential file.
./cpp-builder.sh --platform amd64 --qt-ver '6.9.1' docker-login
# Push the versioned image to the Docker Hub registry.
./cpp-builder.sh --platform amd64 --qt-ver '6.9.1' docker-push
# Makes this version the lates
./cpp-builder.sh --platform amd64 --qt-ver '6.9.1' docker-latest

The final test of the Docker image is the build of the simple DevOps project:

# Build 
./docker-build.sh --qt-ver 6.9.1 -- -mb gnu-debug
./docker-build.sh --qt-ver 6.9.1 -- -mb gw-debug
./docker-build.sh --qt-ver 6.9.1 -- -mb ga-debug

Dependency Regression Bug(s)

The Windows build running in Wine hangs when closing the application where the Linux variant does not. Next is to create a bug report for this at the Qt bug tracker.