The Windows ARM64 release package failed to launch on startup due to missing runtime DLLs (libdbus-1-3.dll, libmd4c.dll, zlib1.dll, libzstd.dll). This failure stemmed from several architectural and CI pipeline issues: 1. CMake unconditionally linked Qt6::DBus whenever available in the sysroot, introducing an unnecessary dependency on Qt6DBus.dll and libdbus-1-3.dll on Windows, even though D-Bus portal dialogs are only used on Linux. 2. The Docker build environment installed MSYS2 ARM64 Qt packages via an unchecked shell loop against a hardcoded package list. This missed crucial transitive runtime dependencies (such as md4c, zlib-ng-compat, libb2, and ICU) and failed silently when downloads or extractions broke. 3. Windows packaging lacked PE import verification, allowing broken packages with unresolved dynamic links to be produced and published without warning. To fix these issues and make image management more accessible: - Restrict Qt6::DBus detection and linking in CMakeLists.txt to Linux only, eliminating the D-Bus dependency from Windows builds. - Introduce scripts/download-mingw-arm64-qt.py to parse the MSYS2 clangarm64 database, resolve the complete transitive dependency graph, and verify essential runtime DLLs during the Docker image build. - Introduce scripts/verify-windows-dlls.py and integrate it into packaging/package-windows.sh to validate PE imports across the executable and bundled Qt plugins, failing packaging if any non-system DLL is missing. - Expose FORCE_REBUILD_IMAGE as a typed GitLab CI pipeline input (spec: inputs) to provide an interactive dropdown when triggering manual pipelines in the UI, and trigger container rebuilds when the download script changes. - Update AGENTS.md documentation to reflect the new dependency and packaging verification workflows.
255 lines
12 KiB
INI
255 lines
12 KiB
INI
FROM ubuntu:24.04
|
|
|
|
ARG QT_VERSION=6.10.3
|
|
ARG QT_INSTALL_DIR=/opt/qt
|
|
ARG ZLIB_VERSION=1.3.1
|
|
ARG LLVM_MINGW_VERSION=20240917
|
|
ARG LIBARCHIVE_VERSION=3.8.0
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
ENV QT_VERSION=${QT_VERSION}
|
|
ENV QT_INSTALL_DIR=${QT_INSTALL_DIR}
|
|
|
|
# ── Build tools & native deps ──────────────────────────────────────────────────
|
|
RUN apt-get update -qq && \
|
|
apt-get install -y --no-install-recommends \
|
|
python3 python3-pip \
|
|
cmake ninja-build pkg-config git \
|
|
build-essential libgl1-mesa-dev \
|
|
gcc g++ mingw-w64 \
|
|
libuchardet-dev \
|
|
zlib1g-dev libquazip1-qt6-dev libminizip-dev libarchive-dev \
|
|
libdjvulibre-dev libwpd-dev \
|
|
libxcb-cursor0 \
|
|
libtiff6 \
|
|
zstd xz-utils wget curl jq zip patchelf file \
|
|
&& rm -rf /var/lib/apt/lists/* && \
|
|
ln -s /usr/lib/x86_64-linux-gnu/libtiff.so.6 /usr/lib/x86_64-linux-gnu/libtiff.so.5
|
|
|
|
# ── aqtinstall ─────────────────────────────────────────────────────────────────
|
|
RUN pip3 install --quiet --break-system-packages aqtinstall
|
|
|
|
# ── Qt 6 for Linux (native build + host tools for cross-compile) ───────────────
|
|
RUN aqt install-qt linux desktop ${QT_VERSION} linux_gcc_64 \
|
|
-m qtimageformats qtpdf qtwebview \
|
|
--outputdir ${QT_INSTALL_DIR}
|
|
|
|
# ── Qt 6 for Windows x86_64 (MinGW cross-compile target) ──────────────────────
|
|
RUN aqt install-qt windows desktop ${QT_VERSION} win64_mingw \
|
|
-m qtimageformats qtpdf qtwebview \
|
|
--outputdir ${QT_INSTALL_DIR}
|
|
|
|
# ── llvm-mingw for Windows ARM64 (aarch64-w64-mingw32) ────────────────────────
|
|
RUN wget -q https://github.com/mstorsjo/llvm-mingw/releases/download/${LLVM_MINGW_VERSION}/llvm-mingw-${LLVM_MINGW_VERSION}-ucrt-ubuntu-20.04-x86_64.tar.xz \
|
|
-O /tmp/llvm-mingw.tar.xz && \
|
|
tar -xf /tmp/llvm-mingw.tar.xz -C /opt && \
|
|
mv /opt/llvm-mingw-${LLVM_MINGW_VERSION}-ucrt-ubuntu-20.04-x86_64 /opt/llvm-mingw && \
|
|
rm /tmp/llvm-mingw.tar.xz
|
|
|
|
ENV PATH="${PATH}:/opt/llvm-mingw/bin"
|
|
|
|
# ── Qt 6 for Windows ARM64 (MinGW cross-compile target) ────────────────────────
|
|
COPY scripts/download-mingw-arm64-qt.py /tmp/download-mingw-arm64-qt.py
|
|
RUN chmod +x /tmp/download-mingw-arm64-qt.py && \
|
|
python3 /tmp/download-mingw-arm64-qt.py --dest "${QT_INSTALL_DIR}/${QT_VERSION}/mingw_arm64" && \
|
|
rm /tmp/download-mingw-arm64-qt.py
|
|
|
|
# ── Toolchain files ────────────────────────────────────────────────────────────
|
|
COPY scripts/mingw-w64-toolchain.cmake /opt/mingw-w64-toolchain.cmake
|
|
COPY scripts/mingw-w64-arm64-toolchain.cmake /opt/mingw-w64-arm64-toolchain.cmake
|
|
|
|
# ── libiconv for MinGW (static, cross-compiled x86_64 & arm64) ────────────────
|
|
RUN wget -q https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz -O /tmp/libiconv.tar.gz && \
|
|
tar -xf /tmp/libiconv.tar.gz -C /tmp && \
|
|
\
|
|
# x86_64
|
|
cd /tmp/libiconv-1.17 && \
|
|
./configure --host=x86_64-w64-mingw32 --prefix=/opt/mingw-sysroot \
|
|
--enable-static --disable-shared --disable-nls && \
|
|
make -j$(nproc) && make install && make clean && \
|
|
\
|
|
# arm64
|
|
./configure --host=aarch64-w64-mingw32 --prefix=/opt/mingw-arm64-sysroot \
|
|
--enable-static --disable-shared --disable-nls && \
|
|
make -j$(nproc) && make install && \
|
|
\
|
|
rm -rf /tmp/libiconv-1.17 /tmp/libiconv.tar.gz
|
|
|
|
# ── uchardet for MinGW (static, cross-compiled x86_64 & arm64) ────────────────
|
|
RUN git clone --depth 1 https://gitlab.freedesktop.org/uchardet/uchardet.git /tmp/uchardet && \
|
|
\
|
|
# x86_64
|
|
cmake -B /tmp/uchardet-build /tmp/uchardet -G Ninja \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_TOOLCHAIN_FILE=/opt/mingw-w64-toolchain.cmake \
|
|
-DCMAKE_INSTALL_PREFIX=/opt/mingw-sysroot \
|
|
-DBUILD_SHARED_LIBS=OFF && \
|
|
cmake --build /tmp/uchardet-build && \
|
|
cmake --install /tmp/uchardet-build && \
|
|
\
|
|
# arm64
|
|
cmake -B /tmp/uchardet-arm64-build /tmp/uchardet -G Ninja \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_TOOLCHAIN_FILE=/opt/mingw-w64-arm64-toolchain.cmake \
|
|
-DCMAKE_INSTALL_PREFIX=/opt/mingw-arm64-sysroot \
|
|
-DBUILD_SHARED_LIBS=OFF && \
|
|
cmake --build /tmp/uchardet-arm64-build && \
|
|
cmake --install /tmp/uchardet-arm64-build && \
|
|
\
|
|
rm -rf /tmp/uchardet /tmp/uchardet-build /tmp/uchardet-arm64-build
|
|
|
|
# ── zlib + minizip for MinGW (static, cross-compiled x86_64 & arm64) ──────────
|
|
RUN wget -q https://github.com/madler/zlib/archive/refs/tags/v${ZLIB_VERSION}.tar.gz -O /tmp/zlib.tar.gz && \
|
|
tar -xf /tmp/zlib.tar.gz -C /tmp && \
|
|
\
|
|
# x86_64 zlib
|
|
cd /tmp/zlib-${ZLIB_VERSION} && \
|
|
make -f win32/Makefile.gcc \
|
|
PREFIX=x86_64-w64-mingw32- \
|
|
BINARY_PATH=/opt/mingw-sysroot/bin \
|
|
INCLUDE_PATH=/opt/mingw-sysroot/include \
|
|
LIBRARY_PATH=/opt/mingw-sysroot/lib \
|
|
SHARED_MODE=0 install && \
|
|
\
|
|
# x86_64 minizip
|
|
cd /tmp/zlib-${ZLIB_VERSION}/contrib/minizip && \
|
|
x86_64-w64-mingw32-gcc -c \
|
|
-I/opt/mingw-sysroot/include \
|
|
-DNOUNCRYPT -DNOCRYPT \
|
|
ioapi.c unzip.c zip.c && \
|
|
x86_64-w64-mingw32-ar rcs libminizip.a ioapi.o unzip.o zip.o && \
|
|
cp libminizip.a /opt/mingw-sysroot/lib/ && \
|
|
mkdir -p /opt/mingw-sysroot/include/minizip && \
|
|
cp ioapi.h unzip.h zip.h /opt/mingw-sysroot/include/minizip/ && \
|
|
mkdir -p /opt/mingw-sysroot/lib/pkgconfig && \
|
|
printf 'prefix=/opt/mingw-sysroot\nlibdir=${prefix}/lib\nincludedir=${prefix}/include/minizip\n\nName: minizip\nDescription: Minizip zip/unzip library\nVersion: %s\nLibs: -L${libdir} -lminizip -lz\nCflags: -I${includedir}\n' "${ZLIB_VERSION}" \
|
|
> /opt/mingw-sysroot/lib/pkgconfig/minizip.pc && \
|
|
\
|
|
# arm64 zlib
|
|
cd /tmp/zlib-${ZLIB_VERSION} && \
|
|
make -f win32/Makefile.gcc clean && \
|
|
make -f win32/Makefile.gcc \
|
|
PREFIX=aarch64-w64-mingw32- \
|
|
BINARY_PATH=/opt/mingw-arm64-sysroot/bin \
|
|
INCLUDE_PATH=/opt/mingw-arm64-sysroot/include \
|
|
LIBRARY_PATH=/opt/mingw-arm64-sysroot/lib \
|
|
SHARED_MODE=0 install && \
|
|
\
|
|
# arm64 minizip
|
|
cd /tmp/zlib-${ZLIB_VERSION}/contrib/minizip && \
|
|
rm -f *.o libminizip.a && \
|
|
aarch64-w64-mingw32-gcc -c \
|
|
-I/opt/mingw-arm64-sysroot/include \
|
|
-DNOUNCRYPT -DNOCRYPT \
|
|
ioapi.c unzip.c zip.c && \
|
|
aarch64-w64-mingw32-ar rcs libminizip.a ioapi.o unzip.o zip.o && \
|
|
cp libminizip.a /opt/mingw-arm64-sysroot/lib/ && \
|
|
mkdir -p /opt/mingw-arm64-sysroot/include/minizip && \
|
|
cp ioapi.h unzip.h zip.h /opt/mingw-arm64-sysroot/include/minizip/ && \
|
|
mkdir -p /opt/mingw-arm64-sysroot/lib/pkgconfig && \
|
|
printf 'prefix=/opt/mingw-arm64-sysroot\nlibdir=${prefix}/lib\nincludedir=${prefix}/include/minizip\n\nName: minizip\nDescription: Minizip zip/unzip library\nVersion: %s\nLibs: -L${libdir} -lminizip -lz\nCflags: -I${includedir}\n' "${ZLIB_VERSION}" \
|
|
> /opt/mingw-arm64-sysroot/lib/pkgconfig/minizip.pc && \
|
|
\
|
|
rm -rf /tmp/zlib-${ZLIB_VERSION} /tmp/zlib.tar.gz
|
|
|
|
# ── libarchive for MinGW (static, cross-compiled x86_64 & arm64) ──────────────
|
|
RUN wget -q https://github.com/libarchive/libarchive/releases/download/v${LIBARCHIVE_VERSION}/libarchive-${LIBARCHIVE_VERSION}.tar.gz -O /tmp/libarchive.tar.gz && \
|
|
tar -xf /tmp/libarchive.tar.gz -C /tmp && \
|
|
\
|
|
# x86_64
|
|
cmake -B /tmp/libarchive-build /tmp/libarchive-${LIBARCHIVE_VERSION} -G Ninja \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_TOOLCHAIN_FILE=/opt/mingw-w64-toolchain.cmake \
|
|
-DCMAKE_INSTALL_PREFIX=/opt/mingw-sysroot \
|
|
-DBUILD_SHARED_LIBS=OFF \
|
|
-DENABLE_TEST=OFF \
|
|
-DENABLE_TAR=OFF \
|
|
-DENABLE_CPIO=OFF \
|
|
-DENABLE_CAT=OFF \
|
|
-DENABLE_UNZIP=OFF \
|
|
-DENABLE_OPENSSL=OFF \
|
|
-DENABLE_LIBB2=OFF \
|
|
-DENABLE_LZ4=OFF \
|
|
-DENABLE_LZO=OFF \
|
|
-DENABLE_MBEDTLS=OFF \
|
|
-DENABLE_NETTLE=OFF \
|
|
-DENABLE_CNG=OFF \
|
|
-DZLIB_INCLUDE_DIR=/opt/mingw-sysroot/include \
|
|
-DZLIB_LIBRARY=/opt/mingw-sysroot/lib/libz.a && \
|
|
cmake --build /tmp/libarchive-build && \
|
|
cmake --install /tmp/libarchive-build && \
|
|
\
|
|
# arm64
|
|
cmake -B /tmp/libarchive-arm64-build /tmp/libarchive-${LIBARCHIVE_VERSION} -G Ninja \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_TOOLCHAIN_FILE=/opt/mingw-w64-arm64-toolchain.cmake \
|
|
-DCMAKE_INSTALL_PREFIX=/opt/mingw-arm64-sysroot \
|
|
-DBUILD_SHARED_LIBS=OFF \
|
|
-DENABLE_TEST=OFF \
|
|
-DENABLE_TAR=OFF \
|
|
-DENABLE_CPIO=OFF \
|
|
-DENABLE_CAT=OFF \
|
|
-DENABLE_UNZIP=OFF \
|
|
-DENABLE_OPENSSL=OFF \
|
|
-DENABLE_LIBB2=OFF \
|
|
-DENABLE_LZ4=OFF \
|
|
-DENABLE_LZO=OFF \
|
|
-DENABLE_MBEDTLS=OFF \
|
|
-DENABLE_NETTLE=OFF \
|
|
-DENABLE_CNG=OFF \
|
|
-DZLIB_INCLUDE_DIR=/opt/mingw-arm64-sysroot/include \
|
|
-DZLIB_LIBRARY=/opt/mingw-arm64-sysroot/lib/libz.a && \
|
|
cmake --build /tmp/libarchive-arm64-build && \
|
|
cmake --install /tmp/libarchive-arm64-build && \
|
|
\
|
|
rm -rf /tmp/libarchive-${LIBARCHIVE_VERSION} /tmp/libarchive.tar.gz /tmp/libarchive-build /tmp/libarchive-arm64-build
|
|
|
|
ENV QT_LINUX_DIR=${QT_INSTALL_DIR}/${QT_VERSION}/gcc_64
|
|
ENV QT_WINDOWS_DIR=${QT_INSTALL_DIR}/${QT_VERSION}/mingw_64
|
|
ENV QT_WINDOWS_ARM64_DIR=${QT_INSTALL_DIR}/${QT_VERSION}/mingw_arm64
|
|
ENV MINGW_SYSROOT=/opt/mingw-sysroot
|
|
ENV MINGW_ARM64_SYSROOT=/opt/mingw-arm64-sysroot
|
|
|
|
# ── linuxdeploy + Qt plugin (for AppImage packaging) ────────────────────────
|
|
RUN wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage \
|
|
-O /usr/local/bin/linuxdeploy && \
|
|
chmod +x /usr/local/bin/linuxdeploy && \
|
|
wget -q https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage \
|
|
-O /usr/local/bin/linuxdeploy-plugin-qt && \
|
|
chmod +x /usr/local/bin/linuxdeploy-plugin-qt
|
|
|
|
# ── FUSE not available in Docker — extract AppImage tools ────────────────────
|
|
# Note: Zeroing AppImage magic bytes 8-10 allows execution under both native Linux and Rosetta 2 emulation
|
|
RUN cd /tmp && \
|
|
printf '\000\000\000' | dd of=/usr/local/bin/linuxdeploy bs=1 seek=8 count=3 conv=notrunc && \
|
|
/usr/local/bin/linuxdeploy --appimage-extract && \
|
|
mv squashfs-root /opt/linuxdeploy && \
|
|
ln -sf /opt/linuxdeploy/AppRun /usr/local/bin/linuxdeploy && \
|
|
printf '\000\000\000' | dd of=/usr/local/bin/linuxdeploy-plugin-qt bs=1 seek=8 count=3 conv=notrunc && \
|
|
/usr/local/bin/linuxdeploy-plugin-qt --appimage-extract && \
|
|
mv squashfs-root /opt/linuxdeploy-plugin-qt && \
|
|
ln -sf /opt/linuxdeploy-plugin-qt/AppRun /usr/local/bin/linuxdeploy-plugin-qt
|
|
|
|
# ── appimagetool (for final AppImage creation) ──────────────────────────────
|
|
RUN wget -q https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage \
|
|
-O /tmp/appimagetool && \
|
|
chmod +x /tmp/appimagetool && \
|
|
printf '\000\000\000' | dd of=/tmp/appimagetool bs=1 seek=8 count=3 conv=notrunc && \
|
|
cd /tmp && /tmp/appimagetool --appimage-extract && \
|
|
mv squashfs-root /opt/appimagetool && \
|
|
ln -sf /opt/appimagetool/AppRun /usr/local/bin/appimagetool && \
|
|
rm /tmp/appimagetool
|
|
|
|
# ── gitlab-runner (shell executor) ───────────────────────────────────────────
|
|
RUN wget -q https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64 \
|
|
-O /usr/local/bin/gitlab-runner && \
|
|
chmod +x /usr/local/bin/gitlab-runner && \
|
|
mkdir -p /etc/gitlab-runner /builds && \
|
|
chmod 777 /builds
|
|
|
|
COPY docker/entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
CMD []
|