Install core via opam fails

Have working installation of OCaml with base and utop installed. However installation of core fails:

▶ opam install core
The following actions will be performed:
  - install ppx_string     v0.14.0 [required by ppx_jane]
  - install ppx_jane       v0.14.0 [required by core]
  - install base_bigstring v0.14.0 [required by core_kernel]
  - install core_kernel    v0.14.0 [required by core]
  - install timezone       v0.14.0 [required by core]
  - install core           v0.14.0
===== 6 to install =====
Do you want to continue? [Y/n] Y

<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[base_bigstring.v0.14.0] found in cache
[core.v0.14.0] found in cache
[core_kernel.v0.14.0] found in cache
[ppx_jane.v0.14.0] found in cache
[ppx_string.v0.14.0] found in cache
[timezone.v0.14.0] found in cache

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] The compilation of ppx_string failed at
        "/Users/joe/.opam/opam-init/hooks/sandbox.sh build dune build -p ppx_string
        -j 3".

#=== ERROR while compiling ppx_string.v0.14.0    =================================#
# context     2.0.7 | macos/x86_64 | ocaml-base-compiler.4.11.0 | https://opam.ocaml.org#09cf053f
# path        ~/.opam/4.11.0/.opam-switch/build/ppx_string.v0.14.0
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p ppx_string -j 3
# exit-code   1
# env-file    ~/.opam/log/ppx_string-36404-dc6e87.env
# output-file ~/.opam/log/ppx_string-36404-dc6e87.out
### output ###
# [...]
# File "src/ppx_string.ml", line 98, characters 6-32:
# 98 |       Stdio.In_channel.with_file loc.loc_start.pos_fname ~f:(fun ic ->
#            ^^^^^^^^^^^^^^^^^^^^^^^^^^
# Error: Unbound module Stdio
# Hint: Did you mean Stdlib?
#       ocamlc src/.ppx_string.objs/byte/ppx_string.{cmo,cmt} (exit 2)
# (cd _build/default &&       /Users/joe/.opam/4.11.0/bin/ocamlc.opt -w -40 -g -bin-annot -I src/.ppx_string.objs/byte -I     /Users/joe/.opam/4.11.0/lib/base -I /Users/joe/.opam/4.11.0/lib/base/base_internalhash_types -I /Users/joe/.opam/4.11.0/lib/base/caml -I /Users/joe/.opam/4.11.0/lib/base/shadow_stdlib -I /Users/joe/.opam/4.11.0/lib/ocaml-compiler-libs/common -I /Users/joe[...]
# File "src/ppx_string.ml", line 98, characters 6-32:
# 98 |       Stdio.In_channel.with_file loc.loc_start.pos_fname ~f:(fun ic ->
#            ^^^^^^^^^^^^^^^^^^^^^^^^^^
# Error: Unbound module Stdio
# Hint: Did you mean Stdlib?

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
+- The following actions failed
| - build ppx_string v0.14.0
+- 
- No changes have been performed

Moreover, I am not sure why the error message includes “Error: Unbound module Stdio” since Opam reports that Stdio is installed.

I have no idea where to begin to fix this. Any help or suggestions would be most welcome.

This has already been fixed upstream (see https://github.com/janestreet/ppx_string/issues/1). You can wait for the opam release or pin to the development version: opam pin add ppx_string --dev.

2 Likes

This should be fixed by https://github.com/ocaml/opam-repository/pull/17091
The default opam repository will take a couple of hours to take this change into account so if you want to speed that up you can use opam repository set-url default git://github.com/ocaml/opam-repository.git to use the git repository directly).

I’m really sorry that hasn’t been fixed sooner, I was in vacations.
Generally if a package fails to compile in opam this is a bug that should be reported here: https://github.com/ocaml/opam-repository/issues so that the opam-repository maintainers can get notified.

Sorry again for the inconvenience.

2 Likes

Vacations are good! There should not be a need for apologizing. :slight_smile:

7 Likes