Review findings addressed (PR #17 bounce): 1. gate.sh put the provisioned cmake/ninja on PATH but never added their OWN lib root to LD_LIBRARY_PATH, so cmake died with exit 127 (librhash.so.0 / libuv.so.1 / libjsoncpp.so.25 not found) and cmake-rs misreported 'is cmake not installed?'. The LLVM_BIN2 block now exports LD_LIBRARY_PATH=~/local-tools/root/usr/lib/x86_64-linux-gnu (same append pattern as the other two roots; final value carries all three). 2. The gate was compile-only. It now runs three steps: cargo check --all-targets (type-check), cargo test --no-run (LINK every test binary), cargo test --lib (EXECUTE headless lib unit tests). 3. docs/build-gate.md: prerequisites list the provisioned cmake's shared-lib root, the test-execution decision record, and the new troubleshooting entry. Verified on the review box: cold full gate exits 0 (GATE_OK), step 1 check then 11m52s test-link codegen then 'running 0 tests / ok' (main has no #[test] fns yet; the inbound netplay PRs add ~38); warm re-run 5.6s.
6.5 KiB
Build gate (review box)
The project's review gate is a single documented command — see scripts/gate.sh:
./scripts/gate.sh # == git submodule update --init --recursive
# + cargo check --all-targets (type-check)
# + cargo test --no-run (link tests)
# + cargo test --lib (run headless lib tests)
It must exit 0 (GATE_OK) on a clean origin/main checkout before any PR
is gated (issue #16: all open PRs were unverifiable because main itself
did not build; review bounce: the gate previously also stopped at
cargo check — compiled but never linked or ran tests).
Why the defaults were changed (.cargo/config.toml)
The fork's original config had two problems on older / non-LLVM hosts:
-C target-cpu=x86-64-v3forx86_64— requires AVX2/BMI2 (Intel Haswell, 2013+). On a pre-AVX2 host (the review box is Sandy Bridge,x86-64-v2) cargo applies the target rustflags to build scripts, which then miscompile:num-traits's build script aborted withmemory allocation of 648518346341351440 bytes failed(0x0900000000000010 — garbage from executing AVX2 instructions, not real OOM). The default build is now portable; the optimised target is opt-in:RUSTFLAGS="-C target-cpu=x86-64-v3" cargo build --release(RUSTFLAGS replaces config rustflags — carry other flags across).[env] AR=llvm-arforced an LLVM archiver that is not installed in the provisioned root — dropped; the platformar(GNU binutils) archives clang objects fine.CC=clang/CXX=clang++are retained becausebuild.rscompiles the parallel-rdp / retroachievements C sources with clang-only flags (-flto=thin);cc-rsresolvesclangvia PATH, so a host simply needs clang on PATH (the review box gets it from the user-local LLVM root viagate.sh).CMAKE_POLICY_VERSION_MINIMUM=3.5is retained (cmake >= 4 needs it for freetype);SDKROOTis retained for macOS SDK discovery.
Host prerequisites (Linux)
cargo/rustc(toolchain pinned inrust-toolchain.toml)clang/clang++on PATH (build.rs, see above)cmake(SDL3, freetype),ar, a realpkg-configfontconfigdev (the GUI text stack pullsyeslogic-fontconfig-systhroughslint→parley→fontique) and X11 dev (SDL3's video backend; the fork's ownsrc/ui.rsusessdl3_sys::videodirectly)libclang(LIBCLANG_PATH) for thebindgenbuild-dependency'sclang-sysprobe
The review box has no system packages for any of these and no sudo, so
user-local roots extracted from Ubuntu .debs are provisioned:
~/local-tools/root/usr/lib/llvm-18/bin— clang/clang++/clang-18 (pluscmake,ninja,pkgconf,wayland-scannerin~/local-tools/root/usr/bin),libclang-18.soin~/local-tools/root/usr/lib/llvm-18/lib~/local-tools/root/usr/lib/x86_64-linux-gnu— the shared-lib root of the SAME provisioned tree as thecmake/ninjaabove. Those binaries link againstlibrhash.so.0,libuv.so.1,libjsoncpp.so.25from this directory; without it onLD_LIBRARY_PATHcmake dies at exec time witherror while loading shared libraries: librhash.so.0(exit 127) andcmake-rsmisreports it asis "cmake" not installed?.gate.shadds this root (see theLLVM_BIN2block), exactly like the other two roots.~/.local/bin-fc/pkg-config— wrapper that execs the realpkgconf(the pypipkg-config/pkgconf-pypishims on~/.local/binwrongly report exit 0 for missing packages, which makes cmake enable optional SDL backends)~/.local/fcroot/usr/lib/x86_64-linux-gnu/pkgconfig—fontconfig.pc,freetype2.pc,zlib.pc,expat.pc,libpng16.pc, X11 pc files, with matching headers and shared libs in the same root
scripts/gate.sh wires all of these onto PATH/env when present; on hosts
with system toolchains the provisioning blocks are no-ops.
What the gate runs, and why
Three steps, so a failure is attributable to exactly one phase:
cargo check --all-targets— type-checks every target including tests. This is the historical blocker phase (#16:num-traitsSIGABRT under the oldtarget-cpu=x86-64-v3).cargo test --no-run— LINKS every test binary. A test that type-checks but cannot link is still a broken gate;cargo checkalone never proves linkability. This answers the review question "the gate compiles the tests but never runs them" for the link half.cargo test --lib— EXECUTES the library unit tests (headless: the netplay state-sync/rollback logic; no window or device needed). Test execution was deliberately NOT assumed: this step is wired in because it completes on the review box.maincurrently has 0#[test]fns (measured in the #16 review; the inbound netplay PRs add ~38), so a clean run reports0 passed— the mechanism, not the coverage, is what this gate guarantees until those PRs land.
Decision record: cargo test --no-run and cargo test --lib were both
verified to complete here; running the full cargo test (which would also
run windowed/bin tests) was not wired because it needs an interactive
display and the review box's gate must stay headless-deterministic.
Troubleshooting
memory allocation of 648518346341351440 bytes failed(SIGABRT in a dependency build script) — an x86-64-v3 (or other AVX2-only) flag is being applied on a pre-AVX2 CPU. Remove the flag / use the portable default.cc1: error: unrecognized argument to '-flto=' option: 'thin'—build.rsrequires clang; gcc rejects-flto=thin. Put clang on PATH (or run viascripts/gate.shon the review box).failed to find tool "clang"insidering's build — clang is missing from PATH.Package 'fontconfig' not found— PKG_CONFIG_PATH is not pointing at a fontconfig dev root (or the pypi pkg-config shim is intercepting).- SDL cmake:
SDL could not find X11 or Wayland development libraries— CMake's FindX11 needsCMAKE_INCLUDE_PATH/CMAKE_LIBRARY_PATHpointed at the X11 dev root (pkg-config alone is not consulted for X11). cmake: error while loading shared libraries: librhash.so.0(exit 127), reported by cmake-rs asis "cmake" not installed?— the provisioned cmake/ninja need their OWN root (~/local-tools/root/usr/lib/x86_64-linux-gnu) onLD_LIBRARY_PATH;gate.sh'sLLVM_BIN2block does this. This was the issue #16 review bounce.