From 16c4f5b69026335338bba57dd26318956a07b38c Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Thu, 4 Jun 2026 01:29:28 +0100 Subject: [PATCH] fix(fixpoint): drive runtime build with stage-1 binary, not compiler/target/blaise MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixpoint.sh's runtime build (step 1) relied on the runtime Makefile's default BLAISE=../compiler/target/blaise. After scripts/rolling-bootstrap.sh — which installs only to releases/ and leaves the live compiler/target/ empty — that path does not exist, so `cd runtime && make` failed with "compiler/target/blaise: No such file or directory" (RUNTIME_FAIL) even though the release binary was perfectly usable. Pass BLAISE= into both the runtime `make` and `make install` so the build never depends on a pre-existing compiler/target/blaise. Resolve the RTL archive into $RTL_ARCHIVE once (installed compiler/target copy, falling back to runtime/target/), and use it at both link sites. Verified by running the patched script from a fresh clone with no compiler/target/ present (the exact post-rolling-bootstrap state): reaches FIXPOINT_OK where it previously aborted at step 1. --- scripts/fixpoint.sh | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/scripts/fixpoint.sh b/scripts/fixpoint.sh index 6cea703..81f114e 100755 --- a/scripts/fixpoint.sh +++ b/scripts/fixpoint.sh @@ -36,11 +36,31 @@ if [ ! -x "$STAGE1_BIN" ]; then fi echo "stage-1: $STAGE1_BIN" -echo "[1/5] rebuild + install runtime" -( cd runtime && make > /tmp/fp_rtl.log 2>&1 && make install >> /tmp/fp_rtl.log 2>&1 ) || { +# The runtime Makefile defaults BLAISE to ../compiler/target/blaise, which may +# not exist yet — e.g. straight after scripts/rolling-bootstrap.sh, which +# installs only to releases/ and leaves the live compiler/target/ empty. +# Drive the runtime build with the stage-1 binary explicitly so fixpoint never +# depends on a pre-existing compiler/target/blaise. make runs inside runtime/, +# so BLAISE must be an absolute path. +ABS_STAGE1=$(readlink -f "$STAGE1_BIN") + +echo "[1/5] rebuild + install runtime (BLAISE=$ABS_STAGE1)" +( cd runtime && make BLAISE="$ABS_STAGE1" > /tmp/fp_rtl.log 2>&1 \ + && make BLAISE="$ABS_STAGE1" install >> /tmp/fp_rtl.log 2>&1 ) || { echo "RUNTIME_FAIL"; tail -5 /tmp/fp_rtl.log; exit 11; } +# Resolve the RTL archive for the link steps below. `make install` copies it +# to compiler/target/, but fall back to the runtime build dir so the link +# never fails on a tree where compiler/target/ was not populated. +if [ -f compiler/target/blaise_rtl.a ]; then + RTL_ARCHIVE=compiler/target/blaise_rtl.a +elif [ -f runtime/target/blaise_rtl.a ]; then + RTL_ARCHIVE=runtime/target/blaise_rtl.a +else + echo "RUNTIME_FAIL: blaise_rtl.a not found after runtime build"; exit 11 +fi + echo "[2/5] stage-1 -> stage-2 IR" "$STAGE1_BIN" --source compiler/src/main/pascal/Blaise.pas \ --unit-path compiler/src/main/pascal --unit-path runtime/src/main/pascal --unit-path stdlib/src/main/pascal \ @@ -57,7 +77,7 @@ echo "[3/5] assemble + link stage-2 binary" vendor/qbe/qbe -o /tmp/fp_stage2.s /tmp/fp_stage2.ssa 2>/tmp/fp_qbe.err || { echo "QBE_FAIL"; cat /tmp/fp_qbe.err; exit 2; } -gcc -o /tmp/fp_blaise2 /tmp/fp_stage2.s compiler/target/blaise_rtl.a 2>/tmp/fp_gcc.err || { +gcc -o /tmp/fp_blaise2 /tmp/fp_stage2.s "$RTL_ARCHIVE" 2>/tmp/fp_gcc.err || { echo "GCC_FAIL"; cat /tmp/fp_gcc.err; exit 3; } @@ -93,7 +113,7 @@ echo "[+1] assemble + link stage-3 binary" vendor/qbe/qbe -o /tmp/fp_stage3.s /tmp/fp_stage3.ssa 2>/tmp/fp_qbe3.err || { echo "QBE3_FAIL"; cat /tmp/fp_qbe3.err; exit 2; } -gcc -o /tmp/fp_blaise3 /tmp/fp_stage3.s compiler/target/blaise_rtl.a 2>/tmp/fp_gcc3.err || { +gcc -o /tmp/fp_blaise3 /tmp/fp_stage3.s "$RTL_ARCHIVE" 2>/tmp/fp_gcc3.err || { echo "GCC3_FAIL"; cat /tmp/fp_gcc3.err; exit 3; }