Skip to content

fix: treat all compilers >= 5.5 as relocatable - #15444

Merged
Alizter merged 2 commits into
ocaml:mainfrom
Alizter:push-wtromkuptkrs
Jul 9, 2026
Merged

Alizter merged 2 commits into
ocaml:mainfrom
Alizter:push-wtromkuptkrs

Conversation

@Alizter

@Alizter Alizter commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Description

Treat compiler packages with version >= 5.5.0 as relocatable package installs, so Dune does not route them through the toolchain cache. Keep the existing legacy marker handling for older relocatable compiler packages.

Related Issue and Motivation

OCaml 5.5 and newer compiler packages are relocatable by version, and the previous solution-wide marker heuristic misses that shape.

Fixes #15443

Checklist

  • Tests added, if applicable.
  • Change log entry added for any user-facing changes.
  • Documentation added for any user-facing changes.

@punchagan punchagan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The code change looks reasonable to me, but I didn't follow why we completely replaced the part testing depending on the relocatable package.

@Alizter

Alizter commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator Author

@punchagan The relocatable package is a virtual package in the vanilla opam repository that servers as a marker for an opam switch. Non-relocatable packages such as older compilers and a few other user packages are marked as conflicting with this virtual package.

The previous heuristic assumed that any solution including a relocatable compiler in the vanilla opam repository would have this package in it's solution. This doesn't seem to be the case since the release of 5.5, and looking back it doesn't seem like it was ever the case even for the alpha releases. This is likely a misunderstanding on my part on the setup for the relocatable compiler in the vanilla opam repository which is slightly different to that of the previous overlay repository.

There are other markers like compiler-cloning that could be used, however these may also change in the future. It therefore seemed better to simply rely on the compiler version from now on.

@Alizter
Alizter requested review from ElectreAAS and punchagan July 8, 2026 10:49
@Alizter Alizter mentioned this pull request Jul 8, 2026
56 tasks done

@ElectreAAS ElectreAAS left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Aside from my small comment, looks good :)

Co-authored-by: Ambre Austen Suhamy <[email protected]>
Signed-off-by: Ali Caglayan <[email protected]>
@Alizter
Alizter merged commit 0f7b1a1 into ocaml:main Jul 9, 2026
16 checks passed
@Alizter
Alizter deleted the push-wtromkuptkrs branch July 9, 2026 11:07
@Alizter Alizter added this to the 3.25.0 milestone Jul 10, 2026
Alizter added a commit that referenced this pull request Jul 20, 2026
Alizter added a commit that referenced this pull request Jul 20, 2026
## Description

Add the changelog entry omitted from #15444 for the OCaml 5.5+
relocatable compiler fix.

## Related

- #15444
- Fixes #15443

## Validation

Not run (changelog-only change).
Alizter added a commit to Alizter/dune that referenced this pull request Jul 20, 2026
Alizter added a commit that referenced this pull request Jul 20, 2026
Backport #15444 onto 3.24.1-rc.

Includes the prerequisite test-only refactor from #14888.
avsm pushed a commit to ocaml/opam-repository that referenced this pull request Jul 23, 2026
CHANGES:

### Fixed

- Fix an internal error (`modules_and_obj_dir: failed lookup`) when generating
  `js_of_ocaml` archive rules for a dune file that defines two libraries with
  the same name distinguished by mutually exclusive `enabled_if` clauses, as
  `ocaml-re` does for `ppx_expect_common` (ocaml/dune#14904, fixes ocaml/dune#14775, @vouillon)

- Fix passing environment variables to formatter actions  (ocaml/dune#15386, @anmonteiro)

- Fix missing source dependency in the sandbox when preprocessing Melange
  sources (ocaml/dune#15395, @anmonteiro)

- Treat OCaml compiler packages version 5.5 or newer as relocatable so their
  installations do not use the toolchain cache (ocaml/dune#15444, fixes ocaml/dune#15443, @Alizter)

- Fix `build_runtime_flags` given in a `js_of_ocaml`/`wasm_of_ocaml` field of
  an executable being silently ignored in separate compilation mode: such
  executables were given the workspace-shared standalone runtime, which is
  built with the default flags. Executables customizing `build_runtime_flags`
  now get their own standalone runtime again. (ocaml/dune#15455, @hhugo)

- Use installed filenames for local package binaries in `%{bin:...}` PATH
  layouts on Windows (ocaml/dune#15518, fixes ocaml/dune#15512, @Alizter)

### Changed

- Revert sandboxing Melange rules by default in the `(library ..)` and
  `(melange.emit ..)` stanzas. In Melange libraries with many modules, sandbox
  creation / destruction dominates build time and adds significant overhead to
  build time (ocaml/dune#15418, @anmonteiro)
craff pushed a commit to craff/opam-repository that referenced this pull request Jul 25, 2026
CHANGES:

### Fixed

- Fix an internal error (`modules_and_obj_dir: failed lookup`) when generating
  `js_of_ocaml` archive rules for a dune file that defines two libraries with
  the same name distinguished by mutually exclusive `enabled_if` clauses, as
  `ocaml-re` does for `ppx_expect_common` (ocaml/dune#14904, fixes ocaml/dune#14775, @vouillon)

- Fix passing environment variables to formatter actions  (ocaml/dune#15386, @anmonteiro)

- Fix missing source dependency in the sandbox when preprocessing Melange
  sources (ocaml/dune#15395, @anmonteiro)

- Treat OCaml compiler packages version 5.5 or newer as relocatable so their
  installations do not use the toolchain cache (ocaml/dune#15444, fixes ocaml/dune#15443, @Alizter)

- Fix `build_runtime_flags` given in a `js_of_ocaml`/`wasm_of_ocaml` field of
  an executable being silently ignored in separate compilation mode: such
  executables were given the workspace-shared standalone runtime, which is
  built with the default flags. Executables customizing `build_runtime_flags`
  now get their own standalone runtime again. (ocaml/dune#15455, @hhugo)

- Use installed filenames for local package binaries in `%{bin:...}` PATH
  layouts on Windows (ocaml/dune#15518, fixes ocaml/dune#15512, @Alizter)

### Changed

- Revert sandboxing Melange rules by default in the `(library ..)` and
  `(melange.emit ..)` stanzas. In Melange libraries with many modules, sandbox
  creation / destruction dominates build time and adds significant overhead to
  build time (ocaml/dune#15418, @anmonteiro)
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.

relocatable compiler detection broken for 5.5.0

3 participants