Commit bf0d02eb

bf0d02eb0409Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 1 file · ~1 modified

Description

Fix macOS-only flaky build: drop &: from the fast-bootstrap rule

The fast-bootstrap rule used a GNU Make 4.3 &: grouped target to run the helper once for both spinel_analyze and spinel_codegen. macOS's system Make is 3.81, which predates &: and runs the recipe once PER target -- two concurrent tools/fast-bootstrap helpers, each exec'ing make FAST_BOOTSTRAP=0, racing on the shared build/*.ast / *.ir intermediates. The corrupted IR then yields "use of undeclared identifier" in codegen1.c. Timing-dependent, so it surfaced intermittently on macOS only.

Drop the grouped target: spinel_analyze carries the helper recipe (which produces both binaries) and spinel_codegen just depends on it, so the helper runs exactly once. Both source stamps remain prereqs of spinel_analyze, so any compiler-source edit still re-runs it.

Co-Authored-By: Claude Opus 4.8 [email protected]

Details

Commit
bf0d02eb0409
Parent
fdc93fdef75a

MakefilemodifiedView file

@@ -375,11 +375,21 @@
375375
376376 ifeq ($(FAST_BOOTSTRAP),auto)
377377 # Default: rebuild BOTH compiler binaries from the previous binaries (stage0)
378-# via tools/fast-bootstrap, gated on the source stamps. Grouped target (&:)
379-# runs the helper once for both. Helper falls back to the CRuby rules
380-# (FAST_BOOTSTRAP=0) when stage0 is missing or can't compile the source.
381-spinel_analyze$(EXE) spinel_codegen$(EXE) &: $(ANALYZE_STAMP) $(CODEGEN_STAMP) $(NODE_TABLE_LOADER_STAMP) $(COMPILER_HELPERS_STAMP) $(SP_RT_LIB) | spinel_parse$(EXE)
378+# via tools/fast-bootstrap, gated on the source stamps. Helper falls back to
379+# the CRuby rules (FAST_BOOTSTRAP=0) when stage0 is missing or can't compile
380+# the source.
381+#
382+# spinel_analyze carries the recipe and the helper produces BOTH binaries;
383+# spinel_codegen just waits on it. We deliberately do NOT use a `&:` grouped
384+# target: macOS's system Make (GNU Make 3.81) predates `&:` and runs the recipe
385+# once PER target, spawning two concurrent helpers that race on the shared
386+# build/*.ast / *.ir intermediates (a flaky macOS-only build break -- corrupt
387+# IR -> "undeclared identifier" in codegen1.c). Listing both source stamps as
388+# prereqs of spinel_analyze means any compiler-source edit re-runs the helper.
389+spinel_analyze$(EXE): $(ANALYZE_STAMP) $(CODEGEN_STAMP) $(NODE_TABLE_LOADER_STAMP) $(COMPILER_HELPERS_STAMP) $(SP_RT_LIB) | spinel_parse$(EXE)
382390 @CC='$(CC)' EXE='$(EXE)' BOOTSTRAP_CFLAGS='$(BOOTSTRAP_CFLAGS)' SP_RT_LIB='$(SP_RT_LIB)' LDFLAGS='$(LDFLAGS)' sh tools/fast-bootstrap
391+spinel_codegen$(EXE): spinel_analyze$(EXE)
392+ @:
383393 else
384394 spinel_analyze$(EXE): build/analyze1.c $(SP_RT_LIB)
385395 $(CC) $(BOOTSTRAP_CFLAGS) -Ilib build/analyze1.c $(SP_RT_LIB) $(LDFLAGS) -lm -o spinel_analyze$(EXE)