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

Cannot install dune using opam on Window due to non-exist directory/file? #11574

Open
yourcomrade opened this issue Mar 26, 2025 · 2 comments
Open
Labels

Comments

@yourcomrade
Copy link

Hi everyone, I am trying to install dune using opam on Window 11. I come across this weird error

opam upgrade dune
dune is not installed. Install it? [y/n] y
The following actions will be performed:
=== install 1 package
  ∗ dune 3.17.2

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
⬇ retrieved dune.3.17.2  (https://opam.ocaml.org/cache)
[ERROR] The compilation of dune.3.17.2 failed at "ocaml boot/bootstrap.ml -j 15".

#=== ERROR while compiling dune.3.17.2 ========================================#
# context     2.3.0 | win32/x86_64 | ocaml.5.3.0 | https://opam.ocaml.org#69dc847b8315666c52c71b48a0952f9226e54067
# path        ~\AppData\Local\opam\default\.opam-switch\build\dune.3.17.2
# command     ~\AppData\Local\opam\default\bin\ocaml.exe boot/bootstrap.ml -j 15
# exit-code   2
# env-file    ~\AppData\Local\opam\log\dune-37044-4ffb30.env
# output-file ~\AppData\Local\opam\log\dune-37044-4ffb30.out
### output ###
# [...]
# File "otherlibs/ocamlc-loc/src\\ocamlc_loc.mli", line 1, characters 4-9:
# Warning 53 [misplaced-attribute]: the "alert" attribute cannot appear in this context
# cd _boot && C:\Users\minh\AppData\Local\opam\default\bin\ocamlopt.opt.exe -c -g -no-alias-deps -w -49-6 -alert -unstable -I +unix -I +threads dune_action_plugin.mli
# File "otherlibs/dune-action-plugin/src\\dune_action_plugin.mli", line 1, characters 4-9:
# Warning 53 [misplaced-attribute]: the "alert" attribute cannot appear in this context
# cd _boot && C:\Users\minh\AppData\Local\opam\default\bin\ocamlopt.opt.exe -o ../_boot\dune.exe -g -I +unix -I +threads unix.cmxa threads.cmxa readdir.o wait4_stubs.o signal_stubs.o platform_stubs.o copyfile_stubs.o spawn_stubs.o dune_stats_stubs.o xdg_stubs.o dune_flock.o dune_digest_stubs.o csexp_rpc_stubs.o fsevents_stubs.o inotify_stubs.o fswatch_win_stubs.o sha512_stubs.o sha256_stubs.o s[...]
# /bin/bash: C:UsersminhAppDataLocalTemplongcmd33326e: No such file or directory
# ** Fatal error: Error during linking
#
# File "caml_startup", line 1:
# Error: Error during linking (exit code 2)
#
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
┌─ The following actions failed
│ λ build dune 3.17.2
└─
╶─ No changes have been performed

It seems like there is a weird path due to concatenating. Also, I look at the directory C:/Users/Minh/AppData/Local/Temp, but I cannot find the longcmd33326e file. Is there any way to solve this?
BTW, my opam version is 2.3.0 and my ocaml version is 5.3.0

@nojb
Copy link
Collaborator

nojb commented Mar 27, 2025

/bin/bash: C:UsersminhAppDataLocalTemplongcmd33326e: No such file or directory

There is an issue with the path passed to the shell (it was not quoted properly). This is probably related to some aspect of your particular setup rather than a Dune issue (see eg https://discuss.ocaml.org/t/dunelongcmd-linking-error-on-windows-using-ocamlopt/15469).

You may want to post your issue in https://discuss.ocaml.org/ or even https://github.com/ocaml/opam/issues instead.

@yourcomrade
Copy link
Author

Hi @nojb, thank you for your suggestions, I have posted this issue in https://discuss.ocaml.org/. I also looked at the discuss dunlongcmd Although it seems a similar error, the problem is that the dune in the discuss has been installed successfully, while this is not the case for me.

@maiste maiste added the windows label Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants