Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCaml 5.3 support #357

Closed
kit-ty-kate opened this issue Oct 21, 2024 · 12 comments
Closed

OCaml 5.3 support #357

kit-ty-kate opened this issue Oct 21, 2024 · 12 comments

Comments

@kit-ty-kate
Copy link
Contributor

Dream currently doesn't compile with OCaml 5.3 and fails with the following error:

#=== ERROR while compiling dream-httpaf.1.0.0~alpha3 ==========================#
# context     2.2.1 | linux/x86_64 | ocaml-base-compiler.5.3.0~alpha1 | file:///home/opam/opam-repository
# path        ~/.opam/5.3~alpha1/.opam-switch/build/dream-httpaf.1.0.0~alpha3
# command     ~/.opam/5.3~alpha1/bin/dune build -p dream-httpaf -j 255
# exit-code   1
# env-file    ~/.opam/log/dream-httpaf-1-ea8029.env
# output-file ~/.opam/log/dream-httpaf-1-ea8029.out
### output ###
# (cd _build/default && /home/opam/.opam/5.3~alpha1/bin/ocamlc.opt -w -40 -g -bin-annot -bin-annot-occurrences -I src/vendor/h2/hpack/util/.gen_huffman.eobjs/byte -I /home/opam/.opam/5.3~alpha1/lib/ocaml/compiler-libs -no-alias-deps -open Dune__exe -o src/vendor/h2/hpack/util/.gen_huffman.eobjs/byte/dune__exe__Gen_huffman.cmo -c -impl src/vendor/h2/hpack/util/gen_huffman.ml)
# File "src/vendor/h2/hpack/util/gen_huffman.ml", line 113, characters 28-71:
# 113 |              [ Exp.constant (Pconst_integer (string_of_int code, None))
#                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# Error: This expression should not be a constructor, the expected type is
#        Parsetree.constant
@aantron
Copy link
Owner

aantron commented Oct 21, 2024

This is a problem in upstream package hpack, which was vendored into Dream until #351, but that PR hasn't been released yet. Does hpack compile with 5.3?

@kit-ty-kate
Copy link
Contributor Author

The latest release does yes. (dune build @all has some issues anmonteiro/ocaml-h2#252 but it doesn't matter for vendored libraries)

@aantron
Copy link
Owner

aantron commented Oct 22, 2024

This should vanish completely with the next releases of hpack and Dream. I'd like to keep it open to make sure I check it. Thank you!

@alxtuz
Copy link
Collaborator

alxtuz commented Oct 24, 2024

I've tried to install Dream from repo with OCaml 5.3.0~alpha1. It fails on opam pin.
opam pin add dream --dev-repo
ends with the following error:

[dream.1.0.0~alpha7] synchronised (git+https://github.com/aantron/dream.git)
dream is now pinned to git+https://github.com/aantron/dream.git (version 1.0.0~alpha7)

[ERROR] Package conflict!
  * No agreement on the version of ocaml:
    - (invariant) → ocaml-base-compiler >= 5.3.0~alpha1 → ocaml-compiler >= 5.3.0~alpha1 → ocaml = 5.3.0
    - dream → dream-httpaf >= 1.0.0~alpha3 → ocaml < 5.3
    You can temporarily relax the switch invariant with `--update-invariant'

[NOTE] Pinning command successful, but your installed packages may be out of sync.

The same error is returned on opam install dream

@kit-ty-kate
Copy link
Contributor Author

@alxtuz The issue is that you're pinning only dream from its remote repository, not the rest of the dream packages. So dream is trying to install dream-httpaf from opam-repository which has been rightfully marked as not compatible with OCaml 5.3. opam install still doesn't work since you've pinned the package.

The correct command is: opam pin add https://github.com/aantron/dream.git. I haven't tried it locally as i don't want to downgrade my installation of h2 but hopefully it should work for you.

@alxtuz
Copy link
Collaborator

alxtuz commented Oct 24, 2024

Now running opam pin add https://github.com/aantron/dream.git fails on compilation of dream-mirage.dev with the error below:

[ERROR] The compilation of dream-mirage.dev failed at "dune build -p dream-mirage -j 7".

#=== ERROR while compiling dream-mirage.dev ===================================#
# context     2.2.1 | linux/x86_64 | ocaml-base-compiler.5.3.0~alpha1 ocaml-compiler.5.3.0~alpha1 | pinned(git+https://github.com/aantron/dream.git#6c75fb9e2289bb1ac7e6f22f6712bb242e1a2f96)
# path        ~/.opam/dream-5.3.0/.opam-switch/build/dream-mirage.dev
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p dream-mirage -j 7
# exit-code   1
# env-file    ~/.opam/log/dream-mirage-10236-0fb5d7.env
# output-file ~/.opam/log/dream-mirage-10236-0fb5d7.out
### output ###
# File "src/mirage/dune", line 18, characters 2-31:
# 18 |   dream-mirage.dream-paf.mirage
#        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# Error: Library "dream-mirage.dream-paf.mirage" not found.
# -> required by library "dream-mirage" in _build/default/src/mirage
# -> required by _build/default/META.dream-mirage
# -> required by _build/install/default/lib/dream-mirage/META
# -> required by _build/default/dream-mirage.install
# -> required by alias install

Whole output attached
opam_pin_add_dream_output.txt

@aantron
Copy link
Owner

aantron commented Oct 24, 2024

Perhaps

opam pin add dream-pure --dev-repo
opam pin add dream-httpaf --dev-repo
opam pin add dream --dev-repo

@kit-ty-kate
Copy link
Contributor Author

The inverse would be required in this case since they already pinned all the dream packages:

opam pin remove dream-mirage

@alxtuz
Copy link
Collaborator

alxtuz commented Oct 24, 2024

Thanks!
Both ways worked in my case. To make sure that pinning packages in that specific order is working I created switch again. Finally, it installed Dream with Ocaml 5.3.0~alpha1 without any errors.

Output attached
Dream_support_ocaml-5.3_output.txt

@aantron
Copy link
Owner

aantron commented Oct 25, 2024

Thank you for checking that @alxtuz and for reporting @kit-ty-kate! I think we can close this issue at this point, because Dream master will continue to compile on 5.3, and if not, then not due to this issue, and any issues with Dream not compiling would likely be upstream.

@aantron aantron closed this as completed Oct 25, 2024
@kit-ty-kate
Copy link
Contributor Author

kit-ty-kate commented Nov 30, 2024

Would it be possible to have a release so people have a way to install the latest release of dream on 5.3 ? The final release is approaching and is currently slotted for mid-december

@aantron
Copy link
Owner

aantron commented Dec 1, 2024

The release is in ocaml/opam-repository#27005. Thanks for the ping @kit-ty-kate!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants