Skip to content

fix(ctypes): sandbox stub generation - #16223

Merged
rgrinberg merged 1 commit into
ocaml:mainfrom
rgrinberg:push-lpvuzlxorpuw
Aug 27, 2026
Merged

rgrinberg merged 1 commit into
ocaml:mainfrom
rgrinberg:push-lpvuzlxorpuw

Conversation

@rgrinberg

@rgrinberg rgrinberg commented Aug 27, 2026 •

Copy link
Copy Markdown
Member

Require sandboxing for Ctypes stub-generation actions in every supported extension version, and propagate ctypes.deps to generated C compilation. Ordinary foreign_stubs retain their existing unsandboxed behavior.

The regression test landed separately in #16222.

@rgrinberg rgrinberg changed the title fix(ctypes): propagate dependencies to C compilation fix(ctypes): sandbox stub generation Aug 27, 2026
@rgrinberg
rgrinberg merged commit fe11ea7 into ocaml:main Aug 27, 2026
36 of 37 checks passed
@Alizter Alizter added this to the 3.25.0 milestone Aug 28, 2026
cuihtlauac added a commit to tarides/xgboost-ocaml that referenced this pull request Oct 21, 2026
dune 3.25 sandboxes Ctypes stub generation and the C compilation of the
generated stubs, honouring only the ctypes stanza's declared deps
(ocaml/dune#16223). dune's own tests for the vendored flags resolver had
to add (deps (source_tree vendor)). main passes a relative
-Lsrc/bindings in its ctypes link flags; this branch passes absolute -I
paths and runtime libraries only.

A Dune next workflow pins dune and dune-configurator to the
3.25.0_alpha0 release tarball (not yet in opam-repository) and builds,
tests and runs the installed-linking check on the vendored path, once
with main checked out and once with this branch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
cuihtlauac added a commit to tarides/xgboost-ocaml that referenced this pull request Oct 25, 2026
dune 3.25 sandboxes Ctypes stub generation and the C compilation of the
generated stubs, honouring only the ctypes stanza's declared deps
(ocaml/dune#16223). dune's own tests for the vendored flags resolver had
to add (deps (source_tree vendor)). main passes a relative
-Lsrc/bindings in its ctypes link flags; this branch passes absolute -I
paths and runtime libraries only.

A Dune next workflow pins dune and dune-configurator to the
3.25.0_alpha0 release tarball (not yet in opam-repository) and builds,
tests and runs the installed-linking check on the vendored path, once
with main checked out and once with this branch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
cuihtlauac added a commit to tarides/xgboost-ocaml that referenced this pull request Oct 25, 2026
dune 3.25 sandboxes Ctypes stub generation and the C compilation of the
generated stubs, honouring only the ctypes stanza's declared deps
(ocaml/dune#16223). dune's own tests for the vendored flags resolver had
to add (deps (source_tree vendor)). main passes a relative
-Lsrc/bindings in its ctypes link flags; this branch passes absolute -I
paths and runtime libraries only.

A Dune next workflow pins dune and dune-configurator to the
3.25.0_alpha0 release tarball (not yet in opam-repository) and builds,
tests and runs the installed-linking check on the vendored path, once
with main checked out and once with this branch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
cuihtlauac added a commit to tarides/xgboost-ocaml that referenced this pull request Oct 28, 2026
dune 3.25 sandboxes Ctypes stub generation and the C compilation of the
generated stubs, honouring only the ctypes stanza's declared deps
(ocaml/dune#16223). dune's own tests for the vendored flags resolver had
to add (deps (source_tree vendor)). main passes a relative
-Lsrc/bindings in its ctypes link flags; this branch passes absolute -I
paths and runtime libraries only.

A Dune next workflow pins dune and dune-configurator to the
3.25.0_alpha0 release tarball (not yet in opam-repository) and builds,
tests and runs the installed-linking check on the vendored path, once
with main checked out and once with this branch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
cuihtlauac added a commit to tarides/xgboost-ocaml that referenced this pull request Nov 8, 2026
…r-flag workarounds (#18)

* build: select between two xgboost_bindings libraries (experiment)

Replace the -L$CAMLORIGIN / install_files.sexp / placeholder-archive
machinery with two definitions of the xgboost_bindings library (public
name xgboost.bindings), mutually exclusive through enabled_if:

- config/provider/detect.ml runs pkg-config and writes `vendored` and
  `system` ("true"/"false"), plus the system path's flags. It lives in
  its own directory with its own executable, because dune reads these
  files while loading other directories' rules.
- src/bindings/system: links the system libxgboost with pkg-config flags.
  Enabled by %{read:.../config/provider/system}.
- src/bindings/vendored: bundles the CMake build through
  (foreign_archives xgboost_vendored dmlc_vendored), so dune builds,
  links, installs and locates the archives itself. Enabled by
  %{read:.../config/provider/vendored}. The CMake rule in config/dune
  uses the same enabled_if, so nothing vendored is built on the system
  path.
- The ctypes descriptions move to src/bindings/common and are shared
  with copy_files.
- config/common: helpers shared by both executables.
- discover.ml also builds dll*_vendored.so companions (whole-archive,
  -force_load on macOS) for plain bytecode, as in #12.

Relies on dune >= 3.15 (%{read:...} in a library's enabled_if, #10250)
and >= 3.16 (same library name with mutually exclusive enabled_if,

check-installed-linking.sh reads the decision from config/provider,
checks the archive files dune installs (lib/xgboost/bindings/*.a,
lib/stublibs/dll*.so) on the vendored path and their absence on the
system path, and drops the -L$CAMLORIGIN assertion. CI also runs on
pushes to experiment/**.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: describe the two-library provider selection

README: an Architecture paragraph on how config/provider picks one of
the two xgboost_bindings libraries and why the decision has its own
directory, the dune versions this relies on, what the vendored path
installs (static archives plus shared builds in lib/stublibs), and the
new src/bindings and config layout. CHANGES: an Unreleased entry.
vendor/README: the version check now lives in config/provider/detect.ml.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* build: load dmlc once on the bytecode path; test it and the toplevel

dllxgboost_vendored.so already carries all of dmlc (both archives are
whole-archived into it), but dlldmlc_vendored.so carried a second copy.
ocamlrun loads every dll with its symbols globally visible, so exported
dmlc symbols resolved to one copy while non-exported state stayed in the
other. Make dlldmlc_vendored.so an empty shared object instead:
foreign_archives still needs the file, but nothing is in it.

check-installed-linking.sh, vendored mode, checks the installed dlls with
nm: every XGBoost symbol the stubs dll needs is defined in
dllxgboost_vendored.so (the stubs dll declares no dependency on it, and
relies on ocamlrun loading the vendored dlls first), and
dlldmlc_vendored.so defines no dmlc symbols. This fires on the previous
build. Both modes also run the plain-bytecode probe with
CAML_LD_LIBRARY_PATH set inside opam exec, as in an opam switch, and load
xgboost into the toplevel with #require.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci: cache dune's build cache on vendored jobs

Each vendored job rebuilt vendor/xgboost with CMake from scratch (about
3 minutes on Linux, over 1 on macOS). Keep ~/.cache/dune between runs
with actions/cache, and run the Build and test steps with
DUNE_CACHE=enabled so dune caches user rules too, the CMake rule in
config/ among them.

Dune tracks the rule's declared inputs (discover.exe, vendor/), not the
C++ compiler or OpenMP it calls, so the key also names the runner image
(ImageOS), as well as OS, arch, OCaml version and a hash of vendor/ and
config/. The run id makes each run save a fresh entry; restore-keys
pick the latest. System jobs are unchanged apart from DUNE_CACHE=disabled
on those two steps. check-installed-linking.sh keeps disabling the cache
for its fresh-copy builds.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci: opam install on opam-repository CI distros (experiment)

Add a Distros workflow: one job per ocaml/opam image that
opam-repository CI builds on (Alpine 3.24, Arch, CentOS Stream 10,
Debian 12 and 13, Fedora 44, openSUSE 16.0 and Tumbleweed, Ubuntu 24.04
and 26.04), OCaml 5.5. scripts/check-distro-install.sh pins the
checkout and runs opam install --with-test, so opam installs the
depexts and each distro takes the path it would take in opam CI:
vendored on most, the system libxgboost-dev on Debian 13 and Ubuntu
26.04. It then builds an installed consumer and runs it native, as
plain bytecode through the switch's stublibs, as byte_complete and in
the toplevel, and reports which provider was used.

FreeBSD (also an opam CI target) is not covered: it needs a VM, not a
container.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci: build main and this branch against dune 3.25.0~alpha0 (experiment)

dune 3.25 sandboxes Ctypes stub generation and the C compilation of the
generated stubs, honouring only the ctypes stanza's declared deps
(ocaml/dune#16223). dune's own tests for the vendored flags resolver had
to add (deps (source_tree vendor)). main passes a relative
-Lsrc/bindings in its ctypes link flags; this branch passes absolute -I
paths and runtime libraries only.

A Dune next workflow pins dune and dune-configurator to the
3.25.0_alpha0 release tarball (not yet in opam-repository) and builds,
tests and runs the installed-linking check on the vendored path, once
with main checked out and once with this branch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci: drop experiment scaffolding; run Distros by hand and weekly

- ci.yml: run on pushes to main only again (the experiment/** trigger
  was for testing this branch without a PR).
- Remove the Dune next workflow. Its question is answered: main and
  this branch both build, test and pass the installed-linking check
  against dune 3.25.0~alpha0
  (https://github.com/tarides/xgboost-ocaml/actions/runs/39532931191).
- Distros: workflow_dispatch plus a weekly schedule (Mondays 03:17 UTC)
  instead of every push. Its 10 jobs each build XGBoost, and the weekly
  run also catches distro package updates.
- check-distro-install.sh: pin with --kind=path, so a copy of a git
  worktree (whose .git points outside the container) or a checkout with
  uncommitted changes also works. The git pin failed locally on a
  worktree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci: one dune cache entry per key, saved only on a miss

The key ended with the run id, so every run (push and pull_request
alike) saved new entries: 21 of them, 22 to 61 MB, after a few hours,
the macOS one growing each time since dune's cache keeps what it has
stored. Drop the run id: on an exact hit actions/cache does not save, so
there is one entry per runner image, OCaml version and vendor/ + config/
contents. Restored, it already cuts the vendored Build step from
173-183 s (Linux) and 77 s (macOS) to 0-1 s
(https://github.com/tarides/xgboost-ocaml/actions/runs/39533895413).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(distros): refresh pacman DB on Arch before depext install

The ocaml/opam:archlinux image ships a snapshot pacman database, but
Arch's mirrors are rolling and drop old package versions. opam's depext
step runs `pacman -Su cmake pkgconf`, which then 404s on a pkgconf build
the mirror no longer serves. Do a full `pacman -Syu` (plus keyring)
first so depexts resolve to versions the mirror actually has.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* build: size the vendored -j without Domain

Domain.recommended_domain_count was the only OCaml 5-only use in the
build, and it pinned the package to OCaml >= 5. Use the same approach
as #20: getconf _NPROCESSORS_ONLN, falling back to nproc --all (both
ignore OMP_NUM_THREADS), still capped at 6 jobs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(changelog): point the 4.11 entry at config/common/common.ml

build_jobs moved from config/discover.ml to the shared config library
on this branch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(linking): load threads with #thread in the toplevel check

On OCaml 4.x, #require "xgboost" in the toplevel fails to load
dllctypes_foreign_stubs.so (undefined caml_c_thread_unregister): the
systhreads stubs are only loaded by topfind's #thread directive, not by
requiring a package that depends on threads. Reproduced with ctypes-foreign
alone on 4.11.2; #thread fixes it there and is harmless on 5.x.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: move the two-library entry to Unreleased; point comments at detect.ml

Rebasing onto the 0.2.4-0.2.6 releases left this branch's CHANGES entry
inside the released 0.2.4 section, and rewrote the 0.2.4 "4.11" entry's
path. Move the entry to a new Unreleased section, note there that the
system-or-vendored decision (with the >= 3.0 check) moves from
config/discover.ml to config/provider/detect.ml, and restore the released
entry as it shipped.

The conf-libxgboost split (0.2.6) added comments in xgboost.opam,
dune-project and packaging/README.md that credit config/discover.ml with
that decision; point them at config/provider/detect.ml, which makes it on
this branch. discover.ml only builds the vendored archives.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci: resolve conf-libxgboost from opam-repository; brew xgboost on both macOS jobs

conf-libxgboost.1 is in opam-repository (ocaml/opam-repository#30964),
so stop naming the local packaging/ template in the deps install. opam
now builds the published package, whose probe runs
`pkg-config --exists xgboost`, so the macOS vendored job installs brew
xgboost too, as opam's depext would on Homebrew. It still takes the
vendored path: PKG_CONFIG_LIBDIR is emptied right after the deps
install.

Also point the Linux system job's .pc comment at config/provider/detect.ml.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci: keep the Linux jobs working on ubuntu-latest = 26.04

GitHub moved ubuntu-latest to 26.04, which broke two things:

- The vendored job: xgboost.opam depends on conf-libxgboost on Ubuntu
  >= 25.10, and now that the deps install takes it from opam-repository
  its `pkg-config --exists xgboost` probe failed. Install the distro
  libxgboost-dev there, as opam's depext would, the same way the macOS
  vendored job installs brew xgboost. The job still takes the vendored
  path: PKG_CONFIG_LIBDIR is emptied after the deps install.
- Both 4.11 jobs (on main too): OCaml 4.11.2 doesn't build with GCC 15,
  whose C23 default reads the runtime's `value (*)()` primitive type as
  taking no arguments. Build that compiler with CC="gcc -std=gnu11".

Also drop a stale $CAMLORIGIN mention from the matrix comment.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* build: split OCaml's c_compiler into program and flags for the dll link

The vendored path links its shared companions (dll*_vendored.so) with
the C compiler OCaml was configured with. That value is recorded as
given to OCaml's configure and may carry flags, e.g. "gcc -std=gnu11",
the CC that 4.11 needs under GCC 15. Running it as one program name
failed: `sh: 1: gcc -std=gnu11: not found`. Split it on whitespace and
pass the flags ahead of the link arguments.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci: run each job where opam would really take its path

ubuntu-latest moved to 26.04, which packages libxgboost 3.0.4 and is
inside xgboost.opam's conf-libxgboost filter. There, opam always
installs libxgboost-dev and takes the system path, so the vendored job
had to install the system lib to get through the deps install and then
hide it. That tested a setup no opam user reaches, and a vendored build
that picked up the system copy would have gone unnoticed.

- Vendored jobs: ubuntu-24.04. It is outside the filter and only
  packages libxgboost < 3.0, so opam and opam-repo-ci vendor there. No
  system lib is installed; the libxgboost-dev step goes away.
- System jobs: ubuntu-26.04 (pinned, not -latest) with the distro
  libxgboost-dev, as conf-libxgboost's depext installs it, instead of
  the pip wheel 3.0.0 with headers from git and a hand-written .pc.
  The exact 3.0.0 minimum stays covered by Distros' Debian 13 job.
- macOS vendored: keep installing brew xgboost and hiding it, but say
  why. Homebrew users never vendor, so the job stands in for MacPorts
  and --no-depexts users. No macOS runner comes without Homebrew.
- Keep CC="gcc -std=gnu11" for 4.11 on Linux, now also on the 24.04
  vendored job, where it covers a c_compiler that carries flags.
- Rewrite the stale comments: vendored is no longer "the opam-repo-ci
  scenario" on every Ubuntu, and --no-depexts no longer guards against
  opam pulling a distro libxgboost, since conf-libxgboost exists to do
  just that.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
raphael-proust pushed a commit to ocaml/opam-repository that referenced this pull request Nov 12, 2026
CHANGES:

### Fixed

- Fix crashes when expanding module artifact pforms (`%{cmi:...}` etc.) with
  `(include_subdirs qualified)`. Qualified modules can now be referenced by
  dotted logical paths such as `%{cmi:Sub_a.Foo}`.
  (ocaml/dune#14498, ocaml/dune#16214, fixes ocaml/dune#14496, @Alizter, @anmonteiro)

- `dune show targets` now accepts build-only directories such as
  `_build/default/.simple.objs`. (ocaml/dune#14664, fixes ocaml/dune#13782, @Alizter)

- Reword the error raised when `%{target}` is used in a rule that omits the
  `(target ...)` (or `(targets ...)`) field, so it points at the missing
  field instead of mentioning "inferred rules". (ocaml/dune#14668, fixes ocaml/dune#12439,
  @Alizter)

- Fix watch mode on Windows by creating the file-watcher sync directory before
  using it, avoiding `open(_build/.sync\0): No such file or directory` when an
  RPC client requests a build. (ocaml/dune#14678, fixes ocaml/dune#14632, @rgrinberg)

- Add file watcher trace events for the Mac and Windows backends (ocaml/dune#14722, @rgrinberg)

- Fix decoding coalesced MacOS file notification events. (ocaml/dune#14725, @rgrinberg)

- Handle directory invalidations correctly in watch mode on MacOS (ocaml/dune#14756, @rgrinberg)

- Update ctime when restoring from the shared cache in copy mode. This prevents
  the trimmer from deleting the file. (ocaml/dune#14777, @rgrinberg)

- Allow the use of all the available variables in the `(enabled_if)` field in
  `(executable ...)` and `(install ...)` stanzas, similar to other stanzas like
  `(library ...)`. (ocaml/dune#14860, fixes ocaml/dune#14789, @punchagan)

- Linux: dune will now wait for the process group to be dead after the group
  leader is dead. This tightens dune's policy for what constitutes
  a successful action. Actions for which dune cannot be clean up the process
  group will now fail. (@rgrinberg, ocaml/dune#14868)

- Fix caching of package sources with symlinks by resolving symlinks after
  fetching the sources, similar to the directory symlinks resolution introduced
  in ocaml/dune#13792 (ocaml/dune#14871, fixes ocaml/dune#14509, @punchagan)

- Fixed wrong suggestion for duplicate entries in `conflicts` field (ocaml/dune#14956,
  fixes ocaml/dune#14903, @Leonidas-from-XIV)

- Fix building Dune on Solaris/illumos by handling its `wait4` semantics
  and retrying interrupted reads when spawning processes. (ocaml/dune#14980, fixes ocaml/dune#14182,
  @jperkin)

- Fix `dune-rpc-lwt` clients so disconnecting shuts down socket output
  without invalidating pending input reads, avoiding `EBADF` errors. (ocaml/dune#14983,
  fixes ocaml/dune#7624, @rgrinberg)

- Dune now restores dependency cutoffs concurrently when they were originally
  computed in parallel, instead of recomputing them one at a time. The
  `cutoffs_that_reduce_concurrency_in_watch_mode` setting, which existed to
  avoid this serialisation, is no longer needed and has been removed.
  (ocaml/dune#15012, @snowleopard)

- Validate project module names before creating the project directory in
  `dune init project`, so aborted initializations no longer leave empty
  directories behind. (ocaml/dune#15014, fixes ocaml/dune#9963, @rgrinberg)

- Fix cram test output sanitization when the project path contains a space.
  Absolute paths are now rewritten to `$TESTCASE_ROOT` even when the path
  contains spaces, and lines with multiple paths have every path sanitized.
  (ocaml/dune#15017, fixes ocaml/dune#14943, @yussypu)

- Improve the error message for private libraries that cannot be dependencies of
  public libraries by mentioning the `(package ...)` field as an alternative to
  giving the private library a public name (ocaml/dune#15070, fixes ocaml/dune#10230, @rgrinberg).

- Clarify the module conflict error shown when a module is used in multiple
  stanzas. The message now explains implicit module ownership and lists all
  relevant stanza kinds (ocaml/dune#15072, fixes ocaml/dune#6598, @rgrinberg).

- Emit relative artifact references in installed `dune-package` files when using
  an absolute external `DUNE_BUILD_DIR`, avoiding build-directory-dependent
  archive and module paths (ocaml/dune#15077, fixes ocaml/dune#11774, @rgrinberg).

- Simplify away `(when false _)` expressions (encoded `Nil`s) that previously
  survived inside `concat` and `when` forms, producing cleaner generated lock
  directories. (ocaml/dune#15092, fixes ocaml/dune#15090, @chizy7)

- Drop `(when false _)` arguments from `run` actions in generated lock
  directories instead of keeping them as no-op entries that were re-encoded as
  `(when false "")`. (ocaml/dune#15128, fixes ocaml/dune#15099, @chizy7)

- Make dune-configurator pass `--personality` to `pkgconf` only for
  version 1.7.0 and later. (ocaml/dune#15142, fixes ocaml/dune#11536, @dra27)

- `dune utop` now accepts an absolute path to a workspace directory instead of
  crashing with an internal error. (ocaml/dune#15272, fixes ocaml/dune#15108, @chizy7)

- Fix watch-mode status lines after source changes interrupt a build. Dune now
  shows the restart status while cancelling the current build and resumes the
  normal progress counter when the next build starts. (ocaml/dune#15289, fixes ocaml/dune#11134,
  @rgrinberg)

- Short-circuit AND and OR expressions in blang. This makes their evaluation
  lazy by default.
  (ocaml/dune#15291, @Sudha247)

- Fix the `%{ppx:ppx1+..+ppxn}` form. Previously, it was just broken
  and pointed at the wrong binary (ocaml/dune#15361, @rgrinberg)

- Remove ppx runtime dependencies from the list of dependencies provided via
  the `root_module` field. If such a runtime dependency is needed, it should be
  written in the `libraries` field. (ocaml/dune#15419, @rgrinberg)

- Avoid rebuilding `js_of_ocaml` library archives on every invocation for
  interface-only and empty libraries. (ocaml/dune#15427, @anmonteiro)

- Do not crash when `~/.config/dune` is a file instead of a directory. Just
  pretend it doesn't exist (ocaml/dune#15475, fixes ocaml/dune#15406, @rgrinberg)

- Dune will now terminate all launched sub-processes even if it received
  `SIGKILL` itself (ocaml/dune#15483, @rgrinberg)

- Account for `ctime` in stat based digest cache (ocaml/dune#15495, @rgrinberg)

- `$ dune install --dry-run` now checks for non empty directories as part of its
  validation (ocaml/dune#15501, @rgrinberg)

- Fix a target-less rule attached to multiple aliases (`(rule (aliases a b)
  ...)`) leaking unrelated contributions between those aliases. Building one
  alias no longer pulls in actions or dependencies that were added only to
  another of the rule's aliases. (ocaml/dune#15581, @NatKarmios)

- Make `dune pkg enabled` query a running Dune RPC server, so it observes
  transient server-side `--pkg enabled` and `--pkg disabled` settings without
  trying to acquire the build lock (ocaml/dune#15589, fixes ocaml/dune#15587, @Alizter)

- Make generated MDX executables inherit `link_flags` from `env` stanzas.
  (ocaml/dune#15614, fixes ocaml/dune#15613, @Alizter)

- Return Unix errors from `Fs_io.read_file` rather than raising them. (ocaml/dune#15641,
  @rgrinberg)

- Correct filesystem trace metrics for file writes and directory scans.
  (ocaml/dune#15686, @rgrinberg)

- Preserve runtime-event ring IDs in Dune traces so consumers can distinguish
  interleaved event streams. (ocaml/dune#15687, @rgrinberg)

- BREAKING CHANGE: in dune-project, (warnings (duplicate_deps ..)) requires
  a dune lang version of 3.22, instead of 3.18 (ocaml/dune#15696, @v-gb).

- Preserve spaces in unquoted filenames when applying Git patches instead of
  truncating paths at the first space (ocaml/dune#15781, @rgrinberg)

- Respect `enabled_if` on `install` stanzas when adding their files and
  directories to the `@all` alias. (ocaml/dune#15895, fixes ocaml/dune#15825, @aryemans)

- Fix Melange emission with installed libraries whose `.cmj` and `.cmi` files
  are stored in the `melange` object directory (ocaml/dune#15949, fixes ocaml/dune#14820,
  @anmonteiro)

- Reject package dependencies in named dependency bindings while decoding
  dependency fields, including for disabled stanzas. (ocaml/dune#15966, @rgrinberg)

- Fix Merlin definition lookup for libraries with private modules
  (ocaml/dune#15977, fixes ocaml/dune#4892, @anmonteiro)

- Fix a crash when generating install rules for a Melange-only implementation
  of an installed virtual library (ocaml/dune#16033, @anmonteiro)

- Prevent build cancellation from crashing Dune when macOS reports `EPERM`
  while signaling a process group (ocaml/dune#16059, fixes ocaml/dune#16053, @rgrinberg)

- Fix `dune pkg outdated` so it fails early with a clear user message if it is
  run when package management is not enabled. (ocaml/dune#16065, @shonfeder)

- Fix watch mode builds remaining stale after the file watcher event queue
  overflows (ocaml/dune#16068, fixes ocaml/dune#16052, @rgrinberg)

- Reject Windows path separators in validated filename components (ocaml/dune#16076,
  @rgrinberg)

- Preserve output following malformed ANSI escape sequences and erase-line
  controls (ocaml/dune#16116, @rgrinberg).

- Resolve relative paths passed to `dune ocaml top-module` from the directory
  where Dune was started, allowing use from workspace subdirectories. (ocaml/dune#16135,
  @rgrinberg)

- Allow `dune ocaml top` to accept absolute directory paths inside the
  workspace. (ocaml/dune#16142, @rgrinberg)

- Allow Dune promotion commands to accept absolute source paths inside the
  workspace. (ocaml/dune#16143, @rgrinberg)

- Allow `dune describe workspace` to accept absolute directory filters inside
  the workspace. (ocaml/dune#16144, @rgrinberg)

- Reject empty `module_systems` fields in `melange.emit` stanzas instead of
  silently producing no JavaScript files (ocaml/dune#16162, @anmonteiro)

- Sandbox PPX lint actions starting with Dune language 3.25 so linters cannot
  observe undeclared build targets. (ocaml/dune#16176, @rgrinberg)

- Prevent diagnostic source locations at compact-position field boundaries from
  being truncated (ocaml/dune#16180, @rgrinberg)

- Sandbox `ocaml-mdx deps` when using MDX extension 0.6 so dependency
  discovery cannot observe undeclared workspace inputs. (ocaml/dune#16183, @rgrinberg)

- Fix missing Odoc generation of OxCaml parameter implementations (ocaml/dune#16200, @art-w)

- Make `Dune_rpc_lwt.V1.Action_plugin.read_directory_with_glob` return an empty listing
  for absent directories (ocaml/dune#16207, fixes ocaml/dune#4445, @rgrinberg)

- Fix compiling Melange implementations of installed virtual libraries, both
  with and without binary annotations, including transitive private module
  dependencies (ocaml/dune#16211, ocaml/dune#16212, ocaml/dune#16272, @anmonteiro)

- Run Ctypes stub generation in a sandbox and honor its declared dependencies.
  (ocaml/dune#16223, @rgrinberg)

- Fix `@opam` failing to promote a generated opam file after it is deleted
  (ocaml/dune#16234, fixes ocaml/dune#16233, @Alizter)

- Rebuild generated Ctypes helpers when headers from Ctypes' implicit include
  directories change (ocaml/dune#16243, @rgrinberg)

- Collect action-provided trace events when an action fails instead of dropping
  them during result validation. (ocaml/dune#16250, @rgrinberg)

- Report the usual program-not-found error when a `dynamic-run` executable is
  missing instead of failing with an assertion. (ocaml/dune#16251, @rgrinberg)

- Prevent rules with duplicate lock declarations from deadlocking by acquiring
  each lock only once. (ocaml/dune#16252, @rgrinberg)

- Prevent concurrent action children from closing shared redirections before
  their siblings use them (ocaml/dune#16257, @rgrinberg)

- Resolve relative paths in forwarded build, runtest, and exec commands from
  the client's directory instead of the RPC server's directory (ocaml/dune#16267,
  @rgrinberg)

- `(env (env-vars ...))` in a `(context ...)` stanza of `dune-workspace` now
  takes precedence over the root `env` stanza, as documented. This affects
  commands such as `dune exec`; rules already used the documented order.
  (ocaml/dune#16290, @punchagan)

- Fix a crash when an opam filter is not a boolean (ocaml/dune#16313, @art-w)

- Correct module paths for generated interfaces of nested qualified module
  groups. (ocaml/dune#16322, @anmonteiro)

- Resolve ``%{cmi:...}``, ``%{cmt:...}``, and ``%{cmti:...}`` against Melange
  module sets when no OCaml module is selected, while preferring OCaml for
  modules selected in both modes. (ocaml/dune#16339, @anmonteiro)

- Reject `.` and `..` as `melange.emit` targets instead of raising an internal
  error (ocaml/dune#16371, @anmonteiro)

- Validate custom toplevel names as filenames, reporting an error for empty
  names and avoiding crashes for names containing paths (ocaml/dune#16373, @anmonteiro)

- Fix Menhir type inference with package-managed relocatable compilers on macOS
  by making the compiler standard library available in the sandbox (ocaml/dune#16374,
  fixes ocaml/dune#15642, @Alizter, @shonfeder)

- Reject invalid Menhir `merge_into` names during parsing to prevent internal
  errors (ocaml/dune#16387, @anmonteiro)

- Reject conflicting module sources in unqualified directory groups,
  including generated sources, instead of silently discarding one
  (ocaml/dune#16414, @anmonteiro)

- fix copying of directory targets on windows (ocaml/dune#16434, @kentookura)

- Track local module dependencies used by Menhir's type inference so generated
  parsers and dependent modules build and rebuild correctly
  (ocaml/dune#16447, fixes ocaml/dune#14450, @anmonteiro)

- Fix Menhir type inference for qualified module group interfaces while keeping
  dependency lookup in terms of logical module names (ocaml/dune#16464, ocaml/dune#16489, ocaml/dune#16497,
  fixes ocaml/dune#8989, @anmonteiro)

- Fix intermittent crashes on Windows caused by unstable file descriptor
  hashing (ocaml/dune#16476, fixes ocaml/dune#16459, @Alizter)

- Explain that forwarded build requests require a watch-mode Dune server instead
  of reporting an internal RPC error. (ocaml/dune#16486, fixes ocaml/dune#16219, @Alizter)

- `(deps (package ...))` now tracks installed files of lock-built packages
  and their package dependencies, rebuilding actions when they change.
  (ocaml/dune#16507, @Alizter)

- Share Rocq plugin layout dependencies between discovery and compilation
  rules, reducing repeated dependency processing in unchanged builds.
  (ocaml/dune#16622, @Alizter)

- Support directory dependencies in hardlink sandboxes by linking their files
  rather than the directories themselves (ocaml/dune#16675, @Alizter).

- Fix recursive copy actions rejecting symbolic links, including file links
  created by symlink sandboxes (ocaml/dune#16686, @rgrinberg).

- Fix copy sandbox failures caused by overlapping directory and file
  dependencies (ocaml/dune#16806, fixes ocaml/dune#16547, @Alizter)

- Fix Menhir inference producing invalid module paths for types imported from
  other modules (ocaml/dune#16952, @anmonteiro)

### Added

- Add `(dirs ...)` to `(include_subdirs (mode qualified) ...)`, allowing
  qualified source directories to be renamed in the module path, including
  when bootstrapping. Mappings can use variables, including reads from generated
  files outside the qualified group (ocaml/dune#13691, ocaml/dune#16418, ocaml/dune#16420, fixes ocaml/dune#7605,
  @anmonteiro).

- Add opt-in action runners via `--action-runner`, and add
  `--sandbox-actions` to run eligible process-spawning actions in a
  bubblewrap-wrapped worker. (ocaml/dune#14240, @rgrinberg)

- Add platform support for DragonFly BSD (ocaml/dune#14774, fixes same issue with lev
  as seen on NetBSD in ocaml/dune#14484, @mneumann).

- Added command, subcommand, and flag completion in the command line.
  Supported shells are `bash`, `zsh`, and `pwsh`.
  See `dune completion [shell] --help`.
  (ocaml/dune#14779, @ElectreAAS)

- Add ``%{git-sha}`` variable that expands to the short git SHA of the current
  HEAD commit, or the empty string when git is unavailable or the workspace is
  not inside a git repository (ocaml/dune#14810, @toots).

- Add a `?static` optional argumentin `Configurator.V1.Pkg_config.get` to instruct pkg-config to get static linking options. (ocaml/dune#14947, @raphael-proust)

- Only generate Melange rule for multi-mode libraries if `melc` is installed
  (ocaml/dune#15021, @anmonteiro)

- Add `Configurator.V1.Pkg_config.query_variable` to query package variables
  through `pkg-config --variable` (ocaml/dune#15078, fixes ocaml/dune#3332, @rgrinberg).

- Add `env_vars` as an alias for the `env-vars` field in `env` stanzas
  (ocaml/dune#15187, fixes ocaml/dune#11424, @rgrinberg).

- Add `@rocqproject` alias to generate all `_RocqProject files
  (ocaml/dune#15221, @rlepigre-skylabs-ai).

- Tab completion for `dune promote` now lists pending promotion files.
  (ocaml/dune#15338, fixes ocaml/dune#7254, @Alizter).

- Add build time information to watch mode (ocaml/dune#15384, @rgrinberg)

- Added the missing `dune tools exec utop` and `dune tools exec odoc` options.
  (ocaml/dune#15388, @Leonidas-from-XIV)

- Display build parallelism in watch mode. (ocaml/dune#15390, @rgrinberg)

- Add process counts, system cpu, user cpu, and wall clock cpu times to trace
  events (ocaml/dune#15401, @rgrinberg)

- Support `--sandbox-actions` on macOS using sandbox-exec. (ocaml/dune#15500,
  @rgrinberg)

- Add `fish` to the shells supported by `dune completion`, enabling
  command, subcommand, and flag completion in the fish shell (ocaml/dune#15515,
  fixes ocaml/dune#15334, @chizy7)

- Display build duration and average process parallelism in the status line for
  batch builds. (ocaml/dune#15564, @rgrinberg)

- Add a `--split-public-names` flag to `dune describe workspace` and `dune
  describe external-lib-deps`. When enabled, the `name`/`names` fields report
  only private names and a new `public_name`/`public_names` field reports the
  public names. (ocaml/dune#15582, @NatKarmios)

- Add a `--include-empty` flag to `dune describe external-lib-deps` to also
  print libraries that have no internal or external dependencies (ocaml/dune#15585,
  @NatKarmios)

- Support qualified module references in fields such as `per_module` when using
  `(include_subdirs qualified)` (ocaml/dune#15633, fixes ocaml/dune#15578, @anmonteiro)

- Display the current build run at the end of watch-mode status lines.
  (ocaml/dune#15673, @rgrinberg)

- Record per-build Memo compute, restore, and cycle-detection metrics in Dune
  traces. (ocaml/dune#15698, @rgrinberg)

- Record discovered, validated, and failed rule counts in Dune traces.
  (ocaml/dune#15701, @rgrinberg)

- Add `%{melange.emit:...}` to reference a Melange output directory and
  depend on its emitted files (ocaml/dune#15751, @anmonteiro)

- Add `(flags ...)` to the `ocamllex` and `ocamlyacc` stanzas to pass custom
  options to parser generators. (ocaml/dune#15907, @rgrinberg)

- Added an opt-in `sat` trace category emitting a `sat/solve` event with
  the SAT solver's stats (variables, clauses, decisions, conflicts) and
  duration. Enable with `DUNE_TRACE=+sat`. (ocaml/dune#15923, @Alizter)

- Add `dune ocaml inferred-mli` to infer an interface with a module's build
  configuration and register it for promotion. (ocaml/dune#16111, fixes ocaml/dune#12727,
  @rgrinberg)

- Add `--no-actions` and `--only-actions` to `dune trace cat` to filter
  events collected from actions. (ocaml/dune#16245, @rgrinberg)

### Changed

- BREAKING CHANGE: Actions no longer see the shared install staging area
  (`_build/install/<context>/{bin,lib,lib/stublibs}`) on `PATH`, `OCAMLPATH` and
  `CAML_LD_LIBRARY_PATH`. An action's environment only contains the packages it
  declares with `(deps (package <pkg>))` (and their library closure, see below).
  Actions that rely on packages being visible (such as tests that `#require` the
  package under test from an mdx block, steps that run `ocamlfind`, a nested `dune`
  build, or load a bytecode stub library) must now declare the package
  dependency explicitly.
  (ocaml/dune#14373, ocaml/dune#16617, @Alizter)
- `(package <pkg>)` now also includes the packages owning the library closures
  of libraries in workspace and installed packages. Installed packages reached
  through those closures also work with Dune language versions older than 2.9.
  (ocaml/dune#14373, ocaml/dune#16362, ocaml/dune#16529, @Alizter, @anmonteiro)

- Extract the structural-hash accumulator into a new `Stdune.Hash`
  module and route `Stdune.Tuple.T2.hash`, `Stdune.Tuple.T3.hash`,
  `Stdune.List.hash`, `Stdune.Result.hash`, and `Resolve.error_hash`
  through it. Hashing these structural shapes no longer allocates per
  call.
  (ocaml/dune#14542, @robinbb)

- Remove `(using melange 0.1)` in Dune 3.25 in favor of version 1.0 of the
  extension. (ocaml/dune#14574, @anmonteiro)

- `$ dune rpc build` invocations no longer queue. All build requests are built
  in parallel. Watch servers started by `$ dune exec --watch` can now also
  handle forwarded build and runtest requests (ocaml/dune#14954, @rgrinberg)

- Report rule build progress as the number of rules built against the total
  number of live rules, rather than rules executed against rules discovered
  during the current run. This affects both the status line and the progress
  reported over RPC. (ocaml/dune#14985, @snowleopard, @pWhite)

- With `--error-reporting=twice`, print an `==== Error Summary ====` separator
  before the deterministic list of errors reported at the end of the build. The
  separator is omitted when there are no errors to report.
  (ocaml/dune#15016, fixes ocaml/dune#14757, @yussypu)

- Enable fuzzy patch application by default for Dune. This is similar to OPAM's
  behaviour, and this makes it easier for packages like OxCaml to build.
  (ocaml/dune#15146, fixes ocaml/dune#15145, @Sudha247)

- Odoc rules are now sandboxed (ocaml/dune#15190, @rgrinberg)

- In watch mode, `$ dune rpc build` requests now complete as soon as their
  requested build finishes, instead of waiting for unrelated concurrent RPC build
  requests in the same build iteration. (ocaml/dune#15191, fixes ocaml/dune#13788, @rgrinberg)

- Cleanup all build processes spawned by dune before starting a fresh build on
  Linux. (ocaml/dune#15239, ocaml/dune#15274, @rgrinberg)

- Show partial output timed out cram tests (ocaml/dune#15269, @rgrinberg)

- In watch mode, `$ dune rpc build` now exits with status 1 when the
  requested build fails. (ocaml/dune#15341, @rgrinberg)

- Debounce file change events in watch mode (ocaml/dune#15344, @rgrinberg)

- Align dune's C compiler vendor detection with the OCaml compiler's own
  identifiers (`msvc`, `icc`, `mingw`, `clang`, `gcc`, `xlc`, `sunc`), so more C
  compilers are recognized without emitting a spurious warning. (ocaml/dune#15423,
  fixes ocaml/dune#14870, @chizy7)

- Never use `$ lsof` for counting file descriptors, as it is not allowed
  to reap processes outside of the scheduler. We have better mechanisms
  on MacOS and Linux for counting file descriptors. So this is only an
  issue on other Unices. (ocaml/dune#15477, @rgrinberg)

- `dune describe workspace` now reports an `origin` field for every module,
  indicating whether its source was written by hand (`source`), generated by a
  `rule` stanza (`dune`, with the generating dune file), produced by `ocamllex`,
  `ocamlyacc`, or `menhir`, or synthesised by dune itself for wrapping
  (`wrapper`). Generated modules point at the responsible file. The
  `--with-origin-deps` and `--with-origin-deps-expanded` flags additionally
  report the dependencies of a `rule`-generated module, as declared and expanded
  to concrete files respectively.
  (ocaml/dune#15478, @nat-karmios)

- Numbers with unit now allow dropping the unit if the number is zero ("0").
  For example, `dune cache trim --trimmed-size 0` and `dune cache trim
  --trimmed-size 0TiB` are now both accepted and equivalent. (ocaml/dune#15498, @reynir)

- Run artifact substitution in background workers. (ocaml/dune#15559, @anmonteiro)

- `dune describe` now reports the public name of an executable (from
  `public_name`/`public_names`) instead of its private name when one is
  available, falling back to the private name otherwise. (ocaml/dune#15582, @NatKarmios)

- Calculate status-line build parallelism from process CPU time rather than
  wall-clock action time; Windows continues to use wall-clock time.
  (ocaml/dune#15685, @rgrinberg)

- Use sha256 instead of md5 for source archives that lack a checksum
  (ocaml/dune#15824, @shunueda)

- Starting with Dune language 3.25, restrict sandboxed actions on Linux
  systems with Landlock ABI 3 or newer from writing outside their sandbox,
  temporary directory, action-trace directory, and `/dev`. Set
  `DUNE_CONFIG__LANDLOCK=disabled` to opt out. (ocaml/dune#15858, @rgrinberg)

- `dune pkg lock` now fails without writing a lock directory when any platform
  requested by `solve_for_platforms` cannot be solved, instead of producing a
  partial lock directory containing only the successful platforms. (ocaml/dune#15981,
  @Alizter)

- Portable lock directories now select one package version across all requested
  platforms, and fail when no common version exists. (ocaml/dune#15982, fixes ocaml/dune#13645,
  fixes ocaml/dune#13647, @Alizter)

- **BREAKING CHANGE:** Reject `:` in context names so they remain portable path
  components (ocaml/dune#16085, @rgrinberg)

- Keep `.t` suffixes in cram test names, including aliases and `applies_to`,
  starting with Dune language 3.25 (ocaml/dune#16146, @rgrinberg)

- Sandbox `ocaml-mdx dune-gen` when using MDX extension 0.6, available from
  Dune 3.25. (ocaml/dune#16177, @rgrinberg)

- Sandbox `pkg-config` queries starting with Dune language 3.25 so they cannot
  observe undeclared workspace inputs. (ocaml/dune#16178, @rgrinberg)

- Remove the experimental OCamlFDO integration, including the `(fdo ...)`
  workspace field (ocaml/dune#16198, @rgrinberg)

- BREAKING CHANGE: Generated files are now read-only even with Dune language
  versions before 2.4, regardless of whether the shared cache is enabled.
  Executable permissions are preserved. (ocaml/dune#16388, @rgrinberg)

- Make newly written shared-cache metadata files read-only to guard against
  accidental modification. (ocaml/dune#16393, @rgrinberg)
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.

2 participants