ocaml / dune

A composable build system for OCaml.
https://dune.build/
MIT License
1.64k stars 410 forks source link

GCC and GLIBC supported minimums for Dune on Linux #10423

Open jonahbeckford opened 7 months ago

jonahbeckford commented 7 months ago

Expected Behavior

TLDR: My expectation is that Dune works on the same platforms that OCaml works on.

In my case the offending GCC is:

Yes, that is a GCC from RHEL/CentOS 7 but that doesn't change the fact that OCaml builds perfectly fine on it while the conventional OCaml build tool (Dune) does not.

I'd like to know what the expectations are for Dune. While I could "fix" the issue below by upstreaming a patch to the vendored spawn library, doing so completely misses the point that it will be a tremendous waste of time for me to use Dune as a foundation to build OCaml software if someone (ex. Dune or the spawn owner Jane Street) arbitrarily decides in the future that they won't support what OCaml supports. I don't think anyone should be in that position. It would be better for me to know now so I have time to course correct.

Ideally, I'm expecting to see one of the following:

  1. A statement "Whatever OCaml LTS (or 5?) builds on Dune should be able to build on", or
  2. A specific GCC + GLIBC minimum version, or
  3. Some handcrafted list of Linux supported distributions; everything else is maybe

If "1" or "2", I'd be happy to submit an upstream patch. If "3" I can start planning to rely less on Dune. Thx.

Actual Behavior

#=== ERROR while compiling dune.3.15.0 ========================================#
# context     2.2.0~alpha0~20221228 | linux/x86_64 |  | git+https://github.com/ocaml/opam-repository.git
# path        /work/.ci/o/2.1.1/.opam-switch/build/dune.3.15.0
# command     /work/.ci/o/2.1.1/bin/ocaml boot/bootstrap.ml -j 1
# exit-code   2
# env-file    /work/.ci/o/log/dune-11998-d28a2a.env
# output-file /work/.ci/o/log/dune-11998-d28a2a.out
### output ###
# ocamlc -output-complete-exe -w -24 -g -o .duneboot.exe -I boot unix.cma boot/libs.ml boot/duneboot.ml
# ./.duneboot.exe -j 1
# cd _boot && /work/.ci/o/2.1.1/bin/ocamlopt.opt -c -g -I +threads spawn_stubs.c
# vendor/spawn/src/spawn_stubs.c: In function 'init_spawn_info':
# vendor/spawn/src/spawn_stubs.c:526:5: error: 'for' loop initial declarations are only allowed in C99 mode
# vendor/spawn/src/spawn_stubs.c:526:5: note: use option -std=c99 or -std=gnu99 to compile your code

Specifications

emillon commented 7 months ago

I agree with you that an official policy for this is important to have, and we're working on that at the moment. I think that the answer is going to be a variant of 1. We don't test a ton of distributions in dune's CI, so I was curious why we didn't catch this at release time, since opam-repo-ci has a much wider test matrix. The reason is that oracle linux 7 (which I assume has the same compiler) has been removed as a test platform since it is difficult to install dev packages there, apparently (?): https://github.com/ocurrent/opam-repo-ci/pull/237 This is the kind of thing that a proper policy should prevent in the future.

emillon commented 7 months ago

(and I realize that this is not the crux of the issue, but this particular gcc fix is going to be fixed in 3.16.0 and 3.15.1, the latter this week or next one)