tarides / ocaml-platform-installer

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

'opam install ocaml-system' fails #108

Closed samoht closed 2 years ago

samoht commented 2 years ago
* 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-6d2010' '--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-6d2010' '--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-6d2010' '--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-6d2010 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-6d2010' '--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-6d2010' '--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-6d2010/_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-91872-df49ea.env
# output-file          ~/.opam/log/ocaml-system-91872-df49ea.out
### output ###
# ERROR: The compiler found at /opt/homebrew/bin/ocamlc has version 4.12.0,
# and this package requires 5.0.0~alpha1.
# You should use e.g. 'opam switch create ocaml-system.4.12.0' instead.

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

I have 4.12 installed in the current switch:

❯ which ocaml
/Users/thomas/git/opam-monorepo/_opam/bin/ocaml
❯ ocaml --version
The OCaml toplevel, version 4.12.0

And:

❯ /opt/homebrew/bin/ocaml --version
The OCaml toplevel, version 4.12.0
panglesd commented 2 years ago

Since we are currently changing the way the compiler version is detected and installed in the sandbox switch, the best would be to rerun the test when the new version is released (potentially after removing the cache, rm -r <opam root>/plugins/ocaml-platform). I'll ping on this issue when we release the new version!

panglesd commented 2 years ago

We made the release modifying the way the compiler version is detected.

Could you remove the cache

rm -r <opam root>/plugins/ocaml-platform

download the last ocaml-platform version

bash < <(curl -sL https://github.com/tarides/ocaml-platform-installer/releases/latest/download/installer.sh)

and try again

ocaml-platform -vv

Thanks!

samoht commented 2 years ago

Seems to work better now, thanks!