ocaml / opam-repository

Main public package repository for opam, the source package manager of OCaml.
https://opam.ocaml.org
Creative Commons Zero v1.0 Universal
516 stars 1.12k forks source link

New menhir.20211125 does not compile alt-ergo.2.4.1 with OCaml <=4.10.1 #20107

Closed maroneze closed 2 years ago

maroneze commented 2 years ago

I'm having this issue:

      ocamlc src/plugins/AB-Why3/.ABWhy3Plugin.objs/byte/aBWhy3Plugin__Why3_parser.{cmo,cmt} (exit 2)
(cd _build/default && /home/andr/.opam/4.08.1-updated/bin/ocamlc.opt -w -40 -bin-annot -g -bin-annot -I src/plugins/AB-Why3/.ABWhy3Plugin.objs/byte -I /home/andr/.opam/4.08.1-updated/lib/alt-ergo-lib -I /home/andr/.opam/4.08.1-updated/lib/alt-ergo-parsers -I /home/andr/.opam/4.08.1-updated/lib/camlzip -I /home/andr/.opam/4.08.1-updated/lib/num -I /home/andr/.opam/4.08.1-updated/lib/ocplib-simplex -I /home/andr/.opam/4.08.1-updated/lib/psmt2-frontend -I /home/andr/.opam/4.08.1-updated/lib/seq -I /home/andr/.opam/4.08.1-updated/lib/stdlib-shims -I /home/andr/.opam/4.08.1-updated/lib/zarith -I /home/andr/.opam/4.08.1-updated/lib/zip -intf-suffix .ml -no-alias-deps -open ABWhy3Plugin -o src/plugins/AB-Why3/.ABWhy3Plugin.objs/byte/aBWhy3Plugin__Why3_parser.cmo -c -impl src/plugins/AB-Why3/why3_parser.ml)
File "src/plugins/AB-Why3/why3_parser.ml", line 461, characters 2-3051:
461 | ..fun _menhir_env _menhir_stack _menhir_s _v ->
462 |     match _menhir_s with
463 |     | MenhirState38 ->
464 |         let (_menhir_env : _menhir_env) = _menhir_env in
465 |         let (_menhir_stack : ('freshtv1629 * _menhir_state * 'tv_type_decl) * Lexing.position) = Obj.magic _menhir_stack in
...
510 |          in
511 |         (_menhir_goto_decl _menhir_env _menhir_stack _menhir_s _v : 'freshtv1632)) : 'freshtv1634)) : 'freshtv1636) : 'freshtv1638)) : 'freshtv1640)
512 |     | _ ->
513 |         _menhir_fail ()
Error: This definition has type
         'ttv_tail.
           _menhir_env ->
           'ttv_tail -> _menhir_state -> 'tv_type_decl list -> 'freshtv1630
       which is less general than
         'ttv_tail 'ttv_return.
           _menhir_env ->
           'ttv_tail -> _menhir_state -> 'tv_type_decl list -> 'ttv_return

If I switch to OCaml >= 4.11.1, then alt-ergo compiles again without problems.

I think we'll have to blacklist menhir.20211125 from alt-ergo, at least when ocaml <= 4.10.1.

maroneze commented 2 years ago

Is is reasonable to add a depends to alt-ergo.2.4.1 with a disjunction, such as "ocaml" {>= "4.11.1" | "menhir" < "20211125"}?

mseri commented 2 years ago

In principle yes, but I don't think that would work: I think you need "ocaml" {>= "4.11.1" | menhir:version < "20211125"} or something like that to specify that constraint

kit-ty-kate commented 2 years ago
"menhir" {>= "<your-usual-constraint>"}
"menhir" {< "20211125" & ocaml:version < "4.10.2"}

will work for that

toots commented 2 years ago

Similar error here: https://github.com/savonet/liquidsoap/issues/2083

Weirdly, it compiles on liquidsoap.2.0.0 with pretty much the same code and deps as 2.0.0~rc1, which does not compile. See: https://github.com/savonet/liquidsoap/issues/2083

kit-ty-kate commented 2 years ago

mmh, there seems to be a similar error in js_of_ocaml as well. I think this is getting bad enough that we might need to restrict menhir.20211125 itself to OCaml >= 4.11. I’ll make a PR right now. cc @fpottier

TheRealMattLear commented 2 years ago

Hi,

Thanks for your efforts here!

I'm still seeing the same problem occur in relation to the liquidsoap project on CentOS 8, will this still take some time or should it be effective already? I can replicate using:

opam init --bare -a -y;
opam switch create 4.08.1;
opam pin -y -n liquidsoap 1.4.4;
opam install -y faad fdkaac flac theora vorbis taglib mad lame cry samplerate liquidsoap;

Further to this, i can see that menhir 20211125 is being installed along with OCaml 4.08.1

bash-4.4$ opam list
# Packages matching: installed
# Name              # Installed # Synopsis
base-bigarray       base
base-threads        base
base-unix           base
ocaml               4.08.1      The OCaml compiler (virtual package)
ocaml-base-compiler 4.08.1      Official release 4.08.1
ocaml-config        1           OCaml Switch Configuration
bash-4.4$ opam install -y faad fdkaac flac theora vorbis taglib mad lame cry liquidsoap;
The following actions will be performed:
  ∗ install ocamlbuild          0.14.0   [required by uchar]
  ∗ install conf-pkg-config     2        [required by flac, liquidsoap]
  ∗ install ocamlfind           1.9.1    [required by theora, liquidsoap, faad, etc.]
  ∗ install conf-which          1        [required by liquidsoap]
  ∗ install dune                2.9.1    [required by lame, cry, fdkaac, taglib]
  ∗ install uchar               0.0.2    [required by sedlex]
  ∗ install conf-taglib         1        [required by taglib]
  ∗ install conf-libpcre        1        [required by pcre]
  ∗ install conf-libflac        1        [required by flac]
  ∗ install ogg                 0.5.2    [required by theora, flac, liquidsoap, vorbis]
  ∗ install mad                 0.4.5
  ∗ install base-bytes          base     [required by faad]
  ∗ install stdlib-shims        0.3.0    [required by ppxlib]
  ∗ install sexplib0            v0.14.0  [required by ppxlib]
  ∗ install result              1.5      [required by dune-configurator]
  ∗ install ppx_derivers        1.2.1    [required by ppxlib]
  ∗ install ocaml-compiler-libs v0.12.4  [required by ppxlib]
  ∗ install menhirSdk           20211125 [required by menhir]
  ∗ install menhirLib           20211125 [required by menhir]
  ∗ install dtools              0.4.4    [required by liquidsoap]
  ∗ install csexp               1.5.1    [required by dune-configurator]
  ∗ install cry                 0.6.5
  ∗ install camomile            1.0.2    [required by liquidsoap]
  ∗ install vorbis              0.7.1
  ∗ install theora              0.3.1
  ∗ install flac                0.1.7
  ∗ install faad                0.4.0
  ∗ install ppxlib              0.23.0   [required by sedlex]
  ∗ install menhir              20211125 [required by liquidsoap]
  ∗ install dune-configurator   2.9.1    [required by lame, fdkaac, taglib]
  ∗ install mm                  0.5.1    [required by liquidsoap]
  ∗ install taglib              0.3.7
  ∗ install pcre                7.4.6    [required by liquidsoap]
  ∗ install lame                0.3.4
  ∗ install gen                 0.5.3    [required by sedlex]
  ∗ install fdkaac              0.3.2
  ∗ install duppy               0.9.2    [required by liquidsoap]
  ∗ install sedlex              2.4      [required by liquidsoap]
  ∗ install liquidsoap          1.4.4*
===== ∗ 39 =====
kit-ty-kate commented 2 years ago

@TheRealMattLear the default repository sadly takes a couple of hours to rebuild. Hopefully this should be done soon enough. In the meantime if you need it really now you can use the git repository directly:

opam remote set-url default git+https://github.com/ocaml/opam-repository.git
fpottier commented 2 years ago

Incidentally, I would strongly recommend using Menhir's --infer mode. I am preparing major changes in Menhir's "code" back-end, allowing Menhir to produce well-typed OCaml code, but these changes will require --infer.