Skip to content

Fix flambda configure flag and parallel builds for pre-4.08 OCaml - #3

Merged
mattgodbolt merged 1 commit into
mainfrom
molty/flambda-configure
Sep 30, 2026
Merged

mattgodbolt merged 1 commit into
mainfrom
molty/flambda-configure

Conversation

@mattgodbolt-molty

Copy link
Copy Markdown
Contributor

Needed to build the versions added in compiler-explorer/infra#2365 (paired with compiler-explorer/compiler-explorer#9140).

What / why

  • flambda flag: [[ "x$IS_AUTOCONF" -eq "xyes" ]] does arithmetic comparison on strings, so it was always true and every -flambda build passed --enable-flambda. Before 4.08 OCaml has a hand-written configure that only accepts -flambda, so 4.05.0 to 4.07.1 flambda builds failed with Unknown option (which is why 4.07.1-flambda has no S3 tarball today). bespoke-build never passes the third arg anyway, so the script now checks the source tree for configure.ac (autoconf, 4.08+) instead.
  • Serial make for pre-autoconf trees: once configure succeeded, 3.12.1, 4.00.1, 4.01.0, 4.05.0 and 4.05.0-flambda failed on make -j races (cp: cannot create regular file 'boot/ocamlrun': Text file busy, ar: fix_code.o: No such file or directory, ocamldoc .cmx not yet built). Those trees now build with -j1; 4.08+ keeps -j$(nproc).

Testing

Built the image locally and ran bash build.sh <v> /dist for all 40 targets in infra#2365 that are missing from S3 (3.12.1 through 5.5.1-flambda, including every pre-4.08 one with the final script). For each, extracted the tarball to /opt/compiler-explorer, checked the top dir is ocaml-<v>/, ran ocaml -version, ocamlopt -version, checked ocamlopt -config reports flambda: true only for -flambda targets, and compiled and ran a small program with ocamlopt. All 40 pass.

🤖 Generated with Claude Code

The IS_AUTOCONF check used arithmetic -eq on strings, so it was always
true and always passed --enable-flambda, which the hand-written configure
used before OCaml 4.08 rejects. Detect autoconf from configure.ac in the
source tree instead. Those older trees also race under make -j, so build
them serially.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019UuPJbXuMH8A4DCDNoiBiv
@mattgodbolt
mattgodbolt merged commit c03fb49 into main Sep 30, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The targeted changes correctly address the documented legacy build failures without affecting modern builds.

Review effort: Balanced
Findings: None

What changed in this PR

Updates OCaml build handling for legacy compiler releases and flambda variants.

Changes:

  • Selects the correct flambda configure flag from the source tree.
  • Forces serial builds for pre-autoconf OCaml versions.
File Description
build/​build.sh Adds version-compatible configuration and build parallelism.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants