Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when doing the up and running with Platform Installer #155

Open
vincentv1345 opened this issue Mar 29, 2023 · 3 comments
Open

Error when doing the up and running with Platform Installer #155

vincentv1345 opened this issue Mar 29, 2023 · 3 comments

Comments

@vincentv1345
Copy link

vincentv1345 commented Mar 29, 2023

My error states this: [ERROR] Command 'opam install ocaml-system.5.0.0 --yes -q --color=never --switch
/tmp/ocaml-platform-sandbox-2083eb --root /root/.opam' failed: exited with 31
I've followed the instructions step by step and my operating system is Windows not sure why this is happening. This occurs when I get to setting up sandbox after I run the command ocaml-platform. I am not sure if my switch is not setup correctly. If you could help me, please let me know.
Thanks,
Vincent

@panglesd
Copy link
Contributor

Hello and thanks for the report!

Unfortunately, this tool is not well tested on Windows. It should work on "linux emulated systems" such as WSL(2) and (maybe) Cygwin-powered installation. I don't think it was tested on Diskuv.

Could you precise how you installed OCaml+opam on Windows?
Also, could you run ocaml-platform -vv and post the result here?

Thanks!

@vincentv1345
Copy link
Author

So the way the steps that I took to install Ocaml on windows were:
I downloaded and ran this like it said on the website: Ocaml 4.14.0 with Git and Visual Studio compiler: setup-diskuv-ocaml-windows_x86_64-1.1.0.exe
Step 2: I ended up forgetting to make the switch on windows and I ended up doing this after I performed the setting up development tools step and the Up and running with platform installer. I did the following commands in order from top to bottom (in Ubunutu):
$ opam pin remove fiber omd stdune dyn ordering dot-merlin-reader yojson --no-action
$ opam install dune merlin ocaml-lsp-server odoc ocamlformat utop
$ sudo apt install build-essential bubblewrap unzip
$ bash < <(curl -sL https://ocaml.org/install-platform.sh)
$ ocaml-platform
Which didn't work and resulted in the first error that I posted. Then I returned to step 2 and attempted to make a directory which resulted me getting an error saying that after I did dkml init it said The compiler switch C:\Users\vince\Desktop\ocamlProject does not exist. and it installed new switch packages. After that I ran the Ocaml-platform command again which resulted in the same error.

After I ran ocaml-platorm -vv the following error occurder
Error:
[WARNING] Running as root is not recommended
[ERROR] The compilation of ocaml-system.5.0.0 failed at "ocaml gen_ocaml_config.ml".

#=== ERROR while compiling ocaml-system.5.0.0 =================================#

context 2.1.4 | linux/x86_64 | | file:///tmp/ocaml-platform-compiler-package-5c11e7

path /tmp/ocaml-platform-sandbox-5005d3/_opam/.opam-switch/build/ocaml-system.5.0.0

command ~/.opam/opam-init/hooks/sandbox.sh build ocaml gen_ocaml_config.ml

exit-code 1

env-file ~/.opam/log/ocaml-system-13829-b015c6.env

output-file ~/.opam/log/ocaml-system-13829-b015c6.out

output

bwrap: execvp ocaml: No such file or directory

The former state can be restored with:
/usr/local/bin/opam switch import "/tmp/ocaml-platform-sandbox-5005d3/_opam/.opam-switch/backup/state-20230329084701.export"
ocaml-platform: [DEBUG] Running: 'opam' 'repository' 'remove' '--all-switches' 'platform_sandbox_compiler_packages-810877906' '--yes' '-q' '--color=never' '--switch' '/tmp/ocaml-platform-sandbox-5005d3' '--root' '/root/.opam'
ocaml-platform: [INFO] Error in 'opam' 'repository' 'remove' '--all-switches' 'platform_sandbox_compiler_packages-810877906' '--yes' '-q' '--color=never' '--switch' '/tmp/ocaml-platform-sandbox-5005d3' '--root' '/root/.opam':
[WARNING] Running as root is not recommended
ocaml-platform: [DEBUG] Running: 'opam' 'switch' 'remove' '/tmp/ocaml-platform-sandbox-5005d3' '--yes' '-q' '--color=never' '--root' '/root/.opam'
ocaml-platform: [INFO] Error in 'opam' 'switch' 'remove' '/tmp/ocaml-platform-sandbox-5005d3' '--yes' '-q' '--color=never' '--root' '/root/.opam':
[WARNING] Running as root is not recommended
ocaml-platform: [ERROR] Command 'opam install ocaml-system.5.0.0 --yes -q --color=never --switch
/tmp/ocaml-platform-sandbox-5005d3 --root /root/.opam' failed: exited with 31
root@LAPTOP-8VP9UDT7:~#

@panglesd
Copy link
Contributor

Thanks for the more precise report. It seems ocaml-platform-installer is not compatible with the diskuv distribution.
For technical reasons (in order to reuse the OCaml of your current switch in the sandbox switch), ocaml-platform-installer manipulates the PATH variable. But, that might be an in incompatible way with how Diskuv uses it. As a result, the ocaml binary is not found at some point...

Your alternative is to install the platform tools by hand: opam install merlin ocamlformat dune ocaml-lsp-server utop odoc dune-release (you can filter which one you want to install). You won't get the benefit from the installer (cached install and no dependencies) but you'll still get the platform tools!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants