Skip to content

Conversation

@dra27
Copy link
Member

@dra27 dra27 commented Oct 18, 2025

This PR fixes various issues:

  • ocamlfind does not build with OCaml 5.0+ on Cygwin (a build failure occurs owing to mishandling of the ; in path in the generation of findlib.conf). (GHA: Add OCaml 5.4 to the test matrix opam#6732)
  • When building on mingw-w64/MSVC with OCaml 5.0+ using MSYS2 for the build environment, findlib.conf is (silently) misgenerated which causes both ocamlfind list and topfind to fail. (MSys2 fails to compile topkg.1.1.0  opam-repository#28636)
  • ocamlfind install contains an incorrect check for META.pkg even when metadir is not in use (which happened to affect the non-opam installation of num).
  • Two minor Windows wrinkles: -s is not a necessary, nor even always valid, flag to cygpath any more and the technically the legacy command for retrieving the Standard Library is broken on old versions of OCaml.

The opening commits are fairly straightforward. The last commit is fiddly, but enacts the following sequence of changes:

  1. The generation of findlib.conf is shifted from being a build operation to a configure operation. That requires the tracking of the native / "Unix" version of various path variables in configure, but is fundamentally simpler overall, because we only have to worry about escaping the backslashes which physically go into findlib.conf and not also escaping characters which may interfere with an escaping sed expression!
  2. That allows tools/patch to be able to assume that it has received a native path (modulo the highly legacy stuff for the MinGW environment, but this probably ought to all be removed).
  3. That then allows various variables which are no longer required the the build to be removed.

Fixes Cygwin failure in ocaml/opam#6732
Closes ocaml/opam-repository#28636

cc @kit-ty-kate (opam), @jmid (opam-repository), @Leonidas-from-XIV (Dune package management)

dra27 added 7 commits October 10, 2025 21:59
Check for META.pkg was executed even when metadir is unset - the effect
is that ocamlfind install would fail if there was a META.pkg in the
current directory... which happens to be the case for the num package!
They've never been used - tracking the paths we need to know about is
hard enough!
Group all the commands generating findlib.conf into a single subshell
invocation.
Possibly an attempt to avoid spaces or unusual characters, but somewhat
dated.
Eliminate the USE_CYGPATH variable by manipulating native paths on
Windows directly in configure. This has two important side-effects:
1. Native paths coming from OCaml are used directly
2. Semi-colon handling in OCaml 5.x is fixed for the Cygwin port
@jmid
Copy link
Member

jmid commented Oct 20, 2025

I can confirm that this fixes the annoying topkg failure on the opam repository 🙂

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.

MSys2 fails to compile topkg.1.1.0

2 participants