Dune 1.11.1 compilation failed

I just tried to rune an opam upgrade and ran into the following error:



<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
[ERROR] The compilation of dune failed at "/Users/basus/.opam/opam-init/hooks/sandbox.sh build ocaml bootstrap.ml".

#=== ERROR while compiling dune.1.11.1 ========================================#
# context     2.0.5 | macos/x86_64 | ocaml-base-compiler.4.08.1 | https://opam.ocaml.org/#8be4290a
# path        ~/.opam/4.08.1/.opam-switch/build/dune.1.11.1
# command     ~/.opam/opam-init/hooks/sandbox.sh build ocaml bootstrap.ml
# exit-code   65
# env-file    ~/.opam/log/dune-16651-0399cc.env
# output-file ~/.opam/log/dune-16651-0399cc.out
### output ###
# /Users/basus/.opam/opam-init/hooks/sandbox.sh: line 8: cd: /Users/basus/.ccache: No such file or directory
# sandbox-exec: empty subpath pattern



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫
β”Œβ”€ The following actions failed
β”‚ Ξ» build dune 1.11.1
└─
╢─ No changes have been performed

There is no .ccache in my home directory, but there is an .cache with opam stuff in it. Is this a typo somewhere?

This is a problem with opam, not dune. opam will try to mount the $HOME/.ccache directory if ccache is installed https://github.com/ocaml/opam/blob/master/src/state/shellscripts/sandbox_exec.sh#L34-L44

To fix this you can either

  1. Uninstall ccache
  2. mkdir ~/.ccache
1 Like

Ahh ok. mkdir ~/.ccache seems to have worked.

I think it would be worth filing an issue upstream so that opam checks if the directory exists before trying to mount it.

1 Like

Just to avoid duplication of work, instead of opening an issue I have submitted a PR to fix it: https://github.com/ocaml/opam/pull/3957

1 Like