diff --git a/ci/runner-cloud-init.yaml b/ci/runner-cloud-init.yaml index c2db181..c05e32e 100644 --- a/ci/runner-cloud-init.yaml +++ b/ci/runner-cloud-init.yaml @@ -68,10 +68,14 @@ runcmd: - chage -d "$(date +%F)" -M -1 root - systemctl enable --now docker # aarch64 builds run under user-mode emulation (DO has no arm droplets). - # Register QEMU with the F and C flags via the multiarch image, exactly as - # helpers/docker-helpers.sh setup_qemu does: Ubuntu's qemu-user-static - # package registers without C, so sudo inside the emulated container fails - # with "effective uid is not 0". Best-effort: an x86-only job never needs it. - - docker run --rm --privileged docker.io/multiarch/qemu-user-static --reset -p yes --credential yes || true + # Register QEMU with the F and C flags via tonistiigi/binfmt, exactly as + # helpers/docker-helpers.sh setup_qemu does. Ubuntu's qemu-user-static + # registers without C, so sudo inside the emulated container fails with + # "effective uid is not 0"; multiarch/qemu-user-static is abandoned at QEMU + # 7.2, under which qmake's compiler probe returns nothing on current gcc + # ("failed to parse default include paths", PR #517). Pin the emulator + # version: the tag is the only thing that decides what every aarch64 build + # runs under. Best-effort: an x86-only job never needs it. + - docker run --rm --privileged docker.io/tonistiigi/binfmt:qemu-v10.2.3-68 --uninstall qemu-aarch64 --install arm64 || true - chown -R runner:runner /home/runner - sudo -u runner /home/runner/start.sh > /home/runner/runner.log 2>&1 diff --git a/helpers/docker-helpers.sh b/helpers/docker-helpers.sh index cc18222..22c8004 100644 --- a/helpers/docker-helpers.sh +++ b/helpers/docker-helpers.sh @@ -91,8 +91,19 @@ setup_qemu() { exit 1 fi - # Register emulators for builds whose target differs from the host. - if ! "$CONTAINER_ENGINE" run --rm --privileged docker.io/multiarch/qemu-user-static --reset -p yes --credential yes >/dev/null 2>&1; then + # Register emulators for builds whose target differs from the host, with + # the F and C flags (tonistiigi/binfmt always sets both). The image tag pins + # the QEMU version every emulated build runs under; multiarch/qemu-user-static + # stopped at QEMU 7.2, which breaks qmake's compiler probe on current gcc. + # Keep ci/runner-cloud-init.yaml on the same tag. Uninstall first: install + # leaves an existing registration (an older emulator) in place and exits 0. + local platform_arch + case "$target_arch" in + aarch64) platform_arch=arm64 ;; + x86_64) platform_arch=amd64 ;; + *) platform_arch="$target_arch" ;; + esac + if ! "$CONTAINER_ENGINE" run --rm --privileged docker.io/tonistiigi/binfmt:qemu-v10.2.3-68 --uninstall "qemu-$target_arch" --install "$platform_arch" >/dev/null 2>&1; then print_error "Failed to set up QEMU emulation" exit 1 fi