tarides / ocaml-platform-installer

The best way for developers to write software in OCaml
ISC License
61 stars 8 forks source link

Error 31 when running ocaml-platform #98

Closed tmattio closed 2 years ago

tmattio commented 2 years ago

Reported by @samoht

❯ ocaml-platform -vv
ocaml-platform: [DEBUG] Running: 'opam' 'config' 'var' 'ocaml:compiler' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
ocaml-platform: [INFO] Error in 'opam' 'config' 'var' 'ocaml:compiler' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam':
[WARNING] var was deprecated in version 2.1 of the opam CLI. Use opam var instead or set OPAMCLI environment variable to 2.0.
* Inferring tools version...
ocaml-platform: [DEBUG] Running: 'opam' 'show' 'dune' 'dune-release' 'merlin' 'ocaml-lsp-server' 'odoc' 'ocamlformat' '-f' 'name,installed-version' '--normalise' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
  -> dune is already installed
  -> dune-release is already installed
  -> merlin is already installed
ocaml-platform: [DEBUG] Running: 'opam' 'show' '-f' 'available-versions' 'ocaml-lsp-server' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
ocaml-platform: [DEBUG] Running: 'opam' 'show' '-f' 'depends:' 'ocaml-lsp-server.1.13.2~5.0preview' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
ocaml-platform: [DEBUG] Running: 'opam' 'show' '-f' 'depends:' 'ocaml-lsp-server.1.13.1' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
ocaml-platform: [DEBUG] Running: 'opam' 'show' '-f' 'depends:' 'ocaml-lsp-server.1.13.0' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
ocaml-platform: [DEBUG] Running: 'opam' 'show' '-f' 'depends:' 'ocaml-lsp-server.1.12.4' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
ocaml-platform: [DEBUG] Running: 'opam' 'show' '-f' 'depends:' 'ocaml-lsp-server.1.12.3' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
ocaml-platform: [DEBUG] Running: 'opam' 'show' '-f' 'depends:' 'ocaml-lsp-server.1.12.2' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
ocaml-platform: [DEBUG] Running: 'opam' 'show' '-f' 'depends:' 'ocaml-lsp-server.1.12.1' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
ocaml-platform: [DEBUG] Running: 'opam' 'show' '-f' 'depends:' 'ocaml-lsp-server.1.12.0' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
ocaml-platform: [DEBUG] Running: 'opam' 'show' '-f' 'depends:' 'ocaml-lsp-server.1.11.6' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
ocaml-platform: [DEBUG] Running: 'opam' 'show' '-f' 'depends:' 'ocaml-lsp-server.1.11.5' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
ocaml-platform: [DEBUG] Running: 'opam' 'show' '-f' 'depends:' 'ocaml-lsp-server.1.11.4' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
ocaml-platform: [DEBUG] Running: 'opam' 'show' '-f' 'depends:' 'ocaml-lsp-server.1.11.3' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
ocaml-platform: [DEBUG] Running: 'opam' 'show' '-f' 'depends:' 'ocaml-lsp-server.1.11.2' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
ocaml-platform: [DEBUG] Running: 'opam' 'show' '-f' 'depends:' 'ocaml-lsp-server.1.11.1' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
ocaml-platform: [DEBUG] Running: 'opam' 'show' '-f' 'depends:' 'ocaml-lsp-server.1.11.0' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
ocaml-platform: [DEBUG] Running: 'opam' 'show' '-f' 'depends:' 'ocaml-lsp-server.1.10.6' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
ocaml-platform: [DEBUG] Running: 'opam' 'show' '-f' 'depends:' 'ocaml-lsp-server.1.10.5' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
  -> ocaml-lsp-server will be installed as ocaml-lsp-server+bin+platform.1.10.5-ocaml4.13.1
  -> odoc is already installed
  -> ocamlformat is already installed
* Building the tools...
  -> Creating a sandbox...
ocaml-platform: [DEBUG] Running: 'opam' 'config' 'var' 'prefix' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
ocaml-platform: [INFO] Error in 'opam' 'config' 'var' 'prefix' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam':
[WARNING] var was deprecated in version 2.1 of the opam CLI. Use opam var instead or set OPAMCLI environment variable to 2.0.
ocaml-platform: [INFO] Creating sandbox switch for building the tools
ocaml-platform: [DEBUG] Running: 'opam' 'switch' 'create' '--no-switch' '/var/folders/88/jkblgplx33db3c6606wyy7rc0000gn/T/ocaml-platform-sandbox-614ef7' '--empty' '--yes' '-q' '--color=never' '--root' '/Users/thomas/.opam'
ocaml-platform: [DEBUG] Running: 'opam' 'repository' 'add' '--this-switch' '-k' 'local' 'platform_sandbox_compiler_packages' '/Users/thomas/.opam/plugins/ocaml-platform/platform_sandbox_compiler_packages' '--yes' '-q' '--color=never' '--switch' '/var/folders/88/jkblgplx33db3c6606wyy7rc0000gn/T/ocaml-platform-sandbox-614ef7' '--root' '/Users/thomas/.opam'
ocaml-platform: [INFO] Error in 'opam' 'repository' 'add' '--this-switch' '-k' 'local' 'platform_sandbox_compiler_packages' '/Users/thomas/.opam/plugins/ocaml-platform/platform_sandbox_compiler_packages' '--yes' '-q' '--color=never' '--switch' '/var/folders/88/jkblgplx33db3c6606wyy7rc0000gn/T/ocaml-platform-sandbox-614ef7' '--root' '/Users/thomas/.opam':
[NOTE] Repository platform_sandbox_compiler_packages has been added to the selections of switch /private/var/folders/88/jkblgplx33db3c6606wyy7rc0000gn/T/ocaml-platform-sandbox-614ef7 only.
       Run `opam repository add platform_sandbox_compiler_packages --all-switches|--set-default' to use it in all existing switches, or in newly created switches, respectively.

ocaml-platform: [DEBUG] Running: 'opam' 'install' 'ocaml-system' '--yes' '-q' '--color=never' '--switch' '/var/folders/88/jkblgplx33db3c6606wyy7rc0000gn/T/ocaml-platform-sandbox-614ef7' '--root' '/Users/thomas/.opam'
ocaml-platform: [INFO] Error in 'opam' 'install' 'ocaml-system' '--yes' '-q' '--color=never' '--switch' '/var/folders/88/jkblgplx33db3c6606wyy7rc0000gn/T/ocaml-platform-sandbox-614ef7' '--root' '/Users/thomas/.opam':
[ERROR] The compilation of ocaml-system.5.0.0~alpha1 failed at "ocaml gen_ocaml_config.ml".

#=== ERROR while compiling ocaml-system.5.0.0~alpha1 ==========================#
# context              2.1.3 | macos/arm64 |  | file:///Users/thomas/.opam/plugins/ocaml-platform/platform_sandbox_compiler_packages
# path                 /private/var/folders/88/jkblgplx33db3c6606wyy7rc0000gn/T/ocaml-platform-sandbox-614ef7/_opam/.opam-switch/build/ocaml-system.5.0.0~alpha1
# command              ~/.opam/opam-init/hooks/sandbox.sh build ocaml gen_ocaml_config.ml
# exit-code            1
# env-file             ~/.opam/log/ocaml-system-1131-691ec0.env
# output-file          ~/.opam/log/ocaml-system-1131-691ec0.out
### output ###
# ERROR: The compiler found at /var/folders/88/jkblgplx33db3c6606wyy7rc0000gn/T/ocaml-platform-system-compiler-10a6bb/ocamlc has version 4.13.1,
# and this package requires 5.0.0~alpha1.
# You should use e.g. 'opam switch create ocaml-system.4.13.1' instead.

The former state can be restored with:
    /opt/homebrew/bin/opam switch import "/private/var/folders/88/jkblgplx33db3c6606wyy7rc0000gn/T/ocaml-platform-sandbox-614ef7/_opam/.opam-switch/backup/state-20220908064624.export"
ocaml-platform: [ERROR] Command 'opam install ocaml-system --yes -q --color=never --switch
           /var/folders/88/jkblgplx33db3c6606wyy7rc0000gn/T/ocaml-platform-sandbox-614ef7
           --root /Users/thomas/.opam' failed: exited with 31

Note that the switch contained other opam repositories:

<><> Repository configuration for switch default ><><><><><><><><><><><><><><><>
 1 alpha         git+https://github.com/kit-ty-kate/opam-alpha-repository.git
 2 dune-universe git+https://github.com/dune-universe/opam-overlays.git
 3 default       https://opam.ocaml.org/

But that the error was reproduced on a fresh switch.

tmattio commented 2 years ago

This should have been fixed in 0.4.0

panglesd commented 2 years ago

Could be, but let's wait for it to be confirmed by @samoht!

samoht commented 2 years ago

I'm not sure I have the same switch available to test it - I'll re-open if I stumble upon this issue again.