Files
Sylpheed/docker/decoder/bin/build-canary
MechaCat02 1fdbb5f197
Some checks failed
CI / Native — linux (pull_request) Failing after 1h1m35s
CI / WASM — Web (pull_request) Successful in 24m37s
CI / Formatting (pull_request) Successful in 26s
fix(decoder): give the container the Canary it is supposed to run
The database mount below was one of three ways the decoder could not reach its
own oracle. The other two are here.

`run-canary` never looked in `Checked/`. It tried `Release/` then `Debug/`, and
both of those exist on this box -- an Aug 28 binary and a Jul 19 one. They boot
the game perfectly well and carry NO `audit_61` branch probe, so a probe run
against either returns zero hits that read as a finding about the game rather
than as a stale binary. Configuration is now the outer loop and location the
inner one, so a `Checked` build anywhere beats a `Release` build anywhere;
`$XENIA_BIN` still overrides everything. Measured here: `Checked` has
`audit_61_branch_probe_pcs`, `Release` and `Debug` do not.

The launcher also now says which instrumentation is missing BEFORE the run,
because the alternative is reading an empty log afterwards and guessing.

`build-canary` built `$PROJECT_DIR/xenia-canary`, which does not exist in this
container -- the source is bind-mounted at `/canary` and the launcher already
exports `XENIA_SRC=/canary`. CONTAINER-NOTES has carried that defect since
2026-08-29 with a symlink workaround and a warning to remember to delete the
symlink afterwards. It now reads `$XENIA_SRC` first, so there is nothing to
remember. Its default configuration moves Release -> Checked to match what
`run-canary` picks; the old default spent a full build on a binary nothing ran.

Two documented blockers are refuted rather than deleted, since the sequence of
wrong readings is what makes the right one checkable: the CONTAINER-NOTES
symlink dance (the warm build volume it was configured against is gone too,
removed in the 2026-09-18 cleanup, so the next build configures cleanly against
`/canary`), and `upstream-baseline.md`'s "`version.h` is never generated" --
`CMakeLists.txt` generates it at configure time now, with a stub fallback.

`decoder-loop.md` claimed the oracle was at `Linux/Release/` and that the probe
was on two side branches; both were true when written and neither is now.

Verified: five pick_bin cases against the extracted function body, and `strings`
on all three real binaries.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-21 18:08:10 +02:00

64 lines
2.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# Configure + build Xenia Canary inside the container.
#
# The build directory is $XENIA_BUILD_DIR (outside the bind-mounted repo) on
# purpose. The host builds this same tree, and CMake caches an absolute compiler
# path and a generator: sharing repo/build between host and container makes each
# one reconfigure and relink everything the other just did.
#
# Parallelism comes from $SYLPH_JOBS, which the entrypoint derives from
# AVAILABLE MEMORY as well as core count — a full-parallel build of this tree
# has OOM-killed the host outright.
#
# `Checked` is the default, and should stay it: it is what the host builds and
# what `run-canary` picks first, so the two agree by construction. Building
# `Release` here instead leaves a second binary that `run-canary` will not use
# -- hours of CPU for something nothing runs. `Checked` is optimised, with
# assertions left in.
#
# build-canary [Checked|Release|Debug] [extra cmake --build args]
set -euo pipefail
CONFIG="${1:-Checked}"; shift || true
# $XENIA_SRC FIRST. In this container the Canary source is bind-mounted at
# `/canary`, and `$PROJECT_DIR/xenia-canary` does not exist -- so the old default
# made this script unusable here, and the documented workaround was to symlink
# `/canary` into the repository and remember to delete it again (CONTAINER-NOTES
# §"The toolchain is real"). The launcher already exports the right path; read it.
SRC="${XENIA_SRC:-${PROJECT_DIR:-/work}/xenia-canary}"
BUILD="${XENIA_BUILD_DIR:-/sylph-home/re/canary-build}"
JOBS="${SYLPH_JOBS:-2}"
[ -d "$SRC" ] || { echo "build-canary: no source at $SRC" >&2; exit 1; }
# Submodules: this tree has drifted before, and a checkout that changes a
# gitlink fails silently into a half-built third_party. Report rather than fix,
# because one submodule here carries an in-tree cmake build whose untracked
# artifacts block an update.
if ! git -C "$SRC" submodule status --recursive 2>/dev/null | grep -qv '^ '; then
:
else
echo "build-canary: note — submodules are not all at their recorded commits:" >&2
git -C "$SRC" submodule status 2>/dev/null | grep -v '^ ' | sed 's/^/ /' >&2
fi
if [ ! -f "$BUILD/CMakeCache.txt" ]; then
echo "==> configuring $BUILD ($CONFIG, Ninja Multi-Config, clang $(clang --version | head -1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+'))"
cmake -S "$SRC" -B "$BUILD" -G "Ninja Multi-Config" \
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
-DXENIA_BUILD_TESTS=OFF -DXENIA_BUILD_MISC=OFF \
-DXENIA_ENABLE_LTO=OFF
fi
echo "==> building $CONFIG with -j$JOBS"
cmake --build "$BUILD" --config "$CONFIG" --parallel "$JOBS" --target xenia_canary "$@"
BIN="$BUILD/bin/Linux/$CONFIG/xenia_canary"
if [ -x "$BIN" ]; then
echo "==> $BIN"
echo " run it with: run-canary"
else
echo "build-canary: target did not produce $BIN" >&2
exit 1
fi