ocaml.org icon indicating copy to clipboard operation
ocaml.org copied to clipboard

Build on OCaml 5 (ocamlnet -safe-string workaround)

Open aantron opened this issue 1 year ago • 5 comments

With this PR, it is possible to build and run OCaml.org on OCaml 5 with

make deps
make start

The build was failing due to problems with a configuration script in ocamlnet, a transitive dependency of OCaml.org, through package River. For details on the problem in ocamlnet, see https://github.com/aantron/ocamlnet/commit/7ef255a0a994ef2721f3359077b36bcdd0428ee4:

Work around broken HAVE_BYTES detection

configure uses ocamlc -safe-string to determine whether the compiler has the bytes type. However, on OCaml 5, this command, without input files, exits with a non-zero exit code and prints No input files. This causes configure to wrongly believe that -safe-string is not supported, which then triggers a multitude of compilation errors.

This commit (in ocamlnet) changes the code to unconditionally assume that bytes is available. A better way is probably to adapt OASIS, or what generated the configure script.

The code in ocamlnet's configure script is here. cc @gerdstolpmann


This PR pins ocamlnet to a fork with the above workaround, until ocamlnet is fixed upstream and released. See the OCaml 5 compatibility MR in ocamlnet.


This PR points package ocamlnet to my own fork on GitHub, which could become a problem for git bisect or other purposes in the future, if the fork were to become inaccessible. However, I see that OCaml.org already has dependencies pointed to other repos, so perhaps this is fine. Please let me know if you'd like me to put the ocamlnet patch somewhere else.

aantron avatar Jul 22 '24 10:07 aantron