melange-re / melange

A mixture of tooling combined to produce JavaScript from OCaml & Reason
https://melange.re
Other
846 stars 52 forks source link

"Error: Unbound module Compression" at dune build #1174

Closed apatterndarkly closed 1 month ago

apatterndarkly commented 1 month ago

Hello, I am attempting to install melange but the build is failing. I'm not very familiar with opam, dune, or any other part of the OCaml ecosystem and so have no idea where to even begin attempting to troubleshoot this issue. I'd be grateful for any advice or assistance.

I see that someone had faced a similar error in a closed issue 948, but this aspect was never addressed because it was unnecessary given that the person who opened the issue was using nix.

Error message and system details below:

[ERROR] The compilation of melange.3.0.0-51 failed at "dune build -p melange -j 19 @install".

#=== ERROR while compiling melange.3.0.0-51 ===================================#
# context     2.2.1 | macos/arm64 | ocaml.5.1.0 | https://opam.ocaml.org#5e7a27da27ca547cb23430fa34e45540cc60cfac
# path        ~/.opam/default/.opam-switch/build/melange.3.0.0-51
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p melange -j 19 @install
# exit-code   1
# env-file    ~/.opam/log/melange-22074-357618.env
# output-file ~/.opam/log/melange-22074-357618.out
### output ###
# [...]
# Grammar has 859 productions.
# Built an LR(0) automaton with 1875 states.
# The grammar is not SLR(1) -- 140 states have a conflict.
# The construction mode is lalr.
# Built an LR(1) automaton with 1875 states.
# 1069 shift/reduce conflicts were silently solved.
# (cd _build/default && /opt/homebrew/bin/ocamlc.opt -w -9 -g -bin-annot -I vendor/melange-compiler-libs/lib/.melange_compiler_libs.objs/byte -I /Users/aya/.opam/default/lib/menhirLib -I /opt/homebrew/lib/ocaml/compiler-libs -I vendor/melange-compiler-libs/wrapper/.melange_wrapper.objs/byte -intf-suffix .ml -no-alias-deps -open Melange_compiler_libs__ -o vendor/melange-compiler-libs/lib/.melang[...]
# File "vendor/melange-compiler-libs/file_formats/cmt_format.ml", line 108, characters 20-43:
# Error: Unbound module Compression
# (cd _build/default && /opt/homebrew/bin/ocamlopt.opt -w -9 -g -O3 -unbox-closures -I vendor/melange-compiler-libs/lib/.melange_compiler_libs.objs/byte -I vendor/melange-compiler-libs/lib/.melange_compiler_libs.objs/native -I /Users/aya/.opam/default/lib/menhirLib -I /opt/homebrew/lib/ocaml/compiler-libs -I vendor/melange-compiler-libs/wrapper/.melange_wrapper.objs/byte -I vendor/melange-compi[...]
# File "vendor/melange-compiler-libs/file_formats/cmi_format.ml", line 45, characters 22-45:
# Error: Unbound module Compression
Mac Studio
M1 Ultra
Sequoia 15.0

Again, I'd appreciate any suggestions. Please let me know if there's any further information I can provide.

Thank you!

anmonteiro commented 1 month ago

Is there a particular reason you need Melange v3 when v4 is out?

in any case, I suspect you might be on OCaml 5.1.0, and this was fixed upstream in 5.1.1

apatterndarkly commented 1 month ago

@anmonteiro You are absolutely correct. I've updated to 5.2.0 and the install succeeded without a hitch:

❯ opam install melange
The following actions will be performed:
=== install 1 package
  ∗ melange 4.0.1-52

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫 
⬇ retrieved melange.4.0.1-52  (https://opam.ocaml.org/cache)
∗ installed melange.4.0.1-52
Done.

Thank you so much for the swift reply and solution. You rock!

apatterndarkly commented 1 month ago

Issue was addressed in OCaml 5.1.1 but the failing build was using 5.1.0