Issue with `gel` prevents install of Jane Street `core` under 5.3.0?

I’ve just tried to install core in an under compiler version 5.3.0 in an opam switch:

opam switch create . 5.3.0
eval $(opam env)
opam install core

And get a build error coming from gel:

#=== ERROR while compiling gel.v0.17.0 ========================================#
# context     2.0.7 | macos/arm64 | ocaml-base-compiler.5.3.0 | https://opam.ocaml.org#9e036af026292d39cebe5a2b7ddbb1b9cf93c8c1
# path        ~/[...]/_opam/.opam-switch/build/gel.v0.17.0
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p gel -j 7
# exit-code   1
# env-file    ~/.opam/log/gel-77399-9afbaf.env
# output-file ~/.opam/log/gel-77399-9afbaf.out
### output ###
# (cd _build/default && /[...]/_opam/bin/ocamlopt.opt -w -40 -g -I .gel.objs/byte -I .gel.objs/native -I /[...]/_opam/lib/base -I /[...]/_opam/lib/base/base_internalhash_types -I /[...]/_opam/lib/base/shadow_stdlib -I [...]
# File "gel.ml", line 53, characters 4-38:
# 53 |     type 'a t = 'a [@@deriving bin_io]
#          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# Error: The module "Bin_prot.Shape.Location" is an alias for module "Bin_shape.Location", which is missing
# (cd _build/default && /[...]/_opam/bin/ocamlc.opt -w -40 -g -bin-annot -bin-annot-occurrences -I .gel.objs/byte -I /[...]/_opam/lib/base -I /[...]/_opam/lib/base/base_internalhash_types -I /[...]/_opam/lib/base/shadow_stdlib -I /[...]
# File "gel.ml", line 53, characters 4-38:
# 53 |     type 'a t = 'a [@@deriving bin_io]
#          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# Error: The module "Bin_prot.Shape.Location" is an alias for module "Bin_shape.Location", which is missing

Is this a known issue or have I screwed something up?

Works fine here with a similar macos/arm64 setup…

∗ installed ppx_jane.v0.17.0
∗ installed gel.v0.17.0
∗ installed int_repr.v0.17.0
∗ installed base_bigstring.v0.17.0
∗ installed ppx_diff.v0.17.0
∗ installed core.v0.17.1

Do you have the latest opam-repo? Looks like some packaging changes to bin_prot recently, but they look unrelated.

Hmm.. I’ve nuked the opam root, then opam update, opam upgrade but still no dice. At least I’ve really screwed it up

I confirm I encountered the same issue using gel to catch-the-bunny, as a nightly endeavor (don’t ask why!). Perhaps this has to do with that preview part?

I had this problem too. Somehow I discovered it was because I didn’t have the GNU patch program (gpatch) installed. I think I looked in opam’s installation log and saw some message about gpatch there.
Anyway, I installed it using homebrew, made sure gpatch was now on my path, cleared out everything and reinstalled successfully.

1 Like

I once had a coworker who encountered strange errors with an open-source project on MacOS X, and these went away when he put his development environment on a case-sensitive filesystem (for POSIX compatibility). It’s been years since I’ve used a Mac, but I hear that case-insensitive is still the default.

Ooof, yes this was the problem - thanks for the tip!

It looks like this PR makes the absence of gpatch on MacOS a bit more visible in opam 2.4:

Lookup at gpatch before patch on macOS now that both homebrew and macports expose gpatch as gpatch by kit-ty-kate · Pull Request #6255 · ocaml/opam · GitHub

Installing gpatch with brew as part of the CI fixed it for me too. Great!

I added a step to call brew update in the CI. At first this did not fix it, and I saw this in the log:

GNU “patch” has been installed as “gpatch”.
If you need to use it as “patch”, you can add a “gnubin” directory
to your PATH from your bashrc like:

PATH=“/opt/homebrew/opt/gpatch/libexec/gnubin:$PATH”

I updated the step to be now:

- name: Install gpatch and add to PATH on macOS
  if: runner.os == 'macOS'
  shell: bash
  run: |
    brew update
    brew install gpatch
    echo "/opt/homebrew/opt/gpatch/libexec/gnubin" >> $GITHUB_PATH

And that fixed it.

To note, maybe there is something that takes care of this already when using opam via setup-ocaml, but here I’m in a workflow using nightly dune and setup-dune, which doesn’t have any gpatch special logic atm. It sounds like a good issued to discuss in this project. Reported here.

Thanks a lot for the solution!

1 Like

I’ve got gpatch installed on my ARM64 Mac, ran bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh)", but still get The module Bin_prot.Shape.Location is an alias for module Bin_shape.Location, which is missing when I try to build gel.

Perhaps the script installer isn’t my best bet?

Same issue when I build from source:

~/s/c/gel % dune build
File "gel.ml", line 53, characters 4-38:
53 |     type 'a t = 'a [@@deriving bin_io]
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: The module Bin_prot.Shape.Location is an alias for module Bin_shape.Location, which is missing
File "gel.ml", line 53, characters 4-38:
53 |     type 'a t = 'a [@@deriving bin_io]
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: The module Bin_prot.Shape.Location is an alias for module Bin_shape.Location, which is missing
~/s/c/gel % ocaml --version
The OCaml toplevel, version 5.1.0```

Seems that OCaml 5.1.0 didn't help much. :(