Skip to content

Successfully sun-setting the bigarray package #5494

@dra27

Description

@dra27

#5420/#5421 removes the internal definition of the bigarray package for OCaml 5.0+. This is of course correct, but it's proving a little painful for ecosystem testing, and this issue explores a possible halfway house.

There is a bug - albeit a very academic one - in the handling of the internal dummy packages. If you have a compiler with 4.08-4.14 configured with --disable-bigarray-lib and you do not install ocamlfind, then a library which includes bigarray in its libraries field will successfully compile (because the dummy package is used by Dune) but the META file for that library will incorrectly include bigarray in the requires field.

The dual of this behaviour is what I think is really wanted for OCaml 5.0+ in Dune. I'd like to suggest two tweaks in both 2.9.x and 3.x:

  1. In OCaml 5.0+ switches, the bigarray package is a no-op, rather than a dummy. That is to say that (libraries bigarray) is effectively ignored - most importantly, it doesn't get emitted in the requires field in META.
  2. In cases where Dune can determine that the package requires OCaml 4.07 or later, a deprecation warning should be emitted if bigarray appears in the libraries field.

The first change would allow code targeting both OCaml 4.06 and earlier and OCaml 5.0+ to continue specifying bigarray. This is what's hurting ecosystem testing at the moment - we have packages which are breaking solely because of the metadata problem, but in fact build successfully in both 4.x and 5.x.

The second - optional - change encourages an ending to all this (and could also be accompanied by similar support on the opam/opam-dune-lint side) by ensuring that code targeting only OCaml 4.07 and later removes the reference to this unnecessary package and leads us towards a day where it's no longer referenced at all.

The alternatives aren't quite as pretty:

  • packages using Bigarray could required to target only 4.07+ but, crucially, this requires new releases of those packages for 5.0 to remove the reference to bigarray in the dune files (there do appear to be packages which otherwise do not require new releases, so it's that which is unfortunate, rather than forcing a 4.07 minimum version of OCaml)
  • ocamlfind could install a dummy bigarray package for OCaml 5.0+ (i.e. as for bytes). However, this introduces a hard build-time dependency on ocamlfind and also has no sunset.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions