From 2f07e11ba0040aec05ba137bcf5c2a4d90104cc0 Mon Sep 17 00:00:00 2001 From: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> Date: Wed, 18 Nov 2026 00:54:33 -0500 Subject: [PATCH] fix(build): make tools/build_local.sh work on x86_64 Linux (#2807) Building the full APK locally on an x86_64 Linux host (rootful Docker, no Docker Desktop) failed in the Xbox backend step and could not be rerun: - The xodus-cli tests re-execute their own arm64 test binary, which needs an aarch64 binfmt handler on the host. Without one the child runs through /bin/sh ("Syntax error: & unexpected"). build-local.sh now checks for the handler up front and prints the one-line fix. - msixvc's streaming tests give each request 40 ms. Under qemu with the whole suite in parallel they time out (28/30 pass in parallel, 30/30 serially), so they run with one test thread when emulated. Native arm64 is unchanged. - The backend container runs as root, so with rootful Docker its outputs in the repo and the cache were root-owned and the next build_local.sh could not remove them. The container now hands them back to the calling user on exit. - README lists the missing requirements: Go, a host C compiler, both MinGW-w64 compilers (i686 with DWARF-2 exceptions; Homebrew's SJLJ build cannot link Rust's i686-pc-windows-gnu) and the arm64 binfmt handler. Verified with a full tools/build_local.sh run on SteamOS (x86_64): all three backend test suites pass and the APK is release-signed. --- README.md | 2 +- tools/xbox/build-local.sh | 9 ++++++++- tools/xbox/build.sh | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 444107fa32..7154309b06 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Help, Preview builds and device reports are on [Discord](https://discord.gg/JRGA ## Build -Needs Docker, Java 17, the Android SDK and NDK, Rust via rustup, GitHub CLI, Python 3 and `zstd`. +Needs Docker, Java 17, the Android SDK and NDK, Rust via rustup, Go, a host C compiler, the x86_64 and i686 MinGW-w64 compilers (i686 with DWARF-2 exceptions, as Debian and Ubuntu ship it; SJLJ builds such as Homebrew's cannot link Rust's `i686-pc-windows-gnu`), GitHub CLI, Python 3 and `zstd`. On x86_64 Linux, Docker also needs an arm64 binfmt handler (`docker run --privileged --rm tonistiigi/binfmt --install arm64`). ```bash tools/build_local.sh diff --git a/tools/xbox/build-local.sh b/tools/xbox/build-local.sh index 979c95b12b..c833a403d0 100755 --- a/tools/xbox/build-local.sh +++ b/tools/xbox/build-local.sh @@ -10,6 +10,12 @@ build=' bash tools/xbox/build.sh ' if [[ $(uname -m) = x86_64 ]]; then + binfmt_magics=$(cat /proc/sys/fs/binfmt_misc/* 2>/dev/null || true) + if [[ $(uname -s) = Linux && $binfmt_magics != *'magic 7f454c460201010000000000000000000200b700'* ]]; then + echo "The Xbox backend tests re-execute their arm64 binaries, which needs an aarch64 binfmt handler on the host." >&2 + echo "Register one with: docker run --privileged --rm tonistiigi/binfmt --install arm64" >&2 + exit 1 + fi cache=${DROIDDECK_XBOX_CACHE:-"${HOME}/.cache/droiddeck-xbox-cross"} platform=linux/amd64 image=droiddeck-xbox-cross:$(shasum -a 256 "$repo/tools/xbox/cross.Dockerfile" | cut -c1-12) @@ -28,4 +34,5 @@ fi mkdir -p "$cache" docker run --rm --platform "$platform" -v "$repo:/src" -v "$cache:/work" -w /src \ -e CARGO_HOME=/work/cargo -e RUSTUP_HOME=/work/rustup -e XBOX_BUILD_DIR=/work/build "$image" \ - bash -lc "set -euo pipefail$build" + bash -lc "set -euo pipefail + trap 'chown -R $(id -u):$(id -g) /work /src/app/src/main/assets/linuxfs 2>/dev/null || true' EXIT$build" diff --git a/tools/xbox/build.sh b/tools/xbox/build.sh index 99bee8c76b..85cdbd3c62 100755 --- a/tools/xbox/build.sh +++ b/tools/xbox/build.sh @@ -16,7 +16,9 @@ cargo build --locked --release --no-default-features --target aarch64-unknown-li if [[ $(uname -m) = aarch64 || -n ${CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER:-} ]]; then cargo test --locked --release --no-default-features --target aarch64-unknown-linux-gnu -p xodus-cli cargo test --locked --release --no-default-features --target aarch64-unknown-linux-gnu -p xodus credential_ - cargo test --locked --release --no-default-features --target aarch64-unknown-linux-gnu -p msixvc streaming_ + msixvc_env=() + [[ $(uname -m) = aarch64 ]] || msixvc_env=(RUST_TEST_THREADS=1) + env "${msixvc_env[@]}" cargo test --locked --release --no-default-features --target aarch64-unknown-linux-gnu -p msixvc streaming_ fi for binary in xodus-cli xodus-service; do install -m755 "$CARGO_TARGET_DIR/aarch64-unknown-linux-gnu/release/$binary" "$out/$binary"