anta40
April 9, 2025, 8:19pm
1
I experienced this confusing errors when installing async
=== install 5 packages
∗ async v0.17.0
∗ async_log v0.17.0 [required by async]
∗ async_unix v0.17.0 [required by async]
∗ core_unix v0.17.0 [required by async]
∗ textutils v0.17.0 [required by async]
Proceed with ∗ 5 installations? [y/n] y
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><> 🐫
⬇ retrieved async_log.v0.17.0 (cached)
⬇ retrieved async_unix.v0.17.0 (cached)
⬇ retrieved async.v0.17.0 (cached)
⬇ retrieved textutils.v0.17.0 (cached)
⬇ retrieved core_unix.v0.17.0 (cached)
[ERROR] The compilation of core_unix.v0.17.0 failed at "dune build -p core_unix -j 7".
#=== ERROR while compiling core_unix.v0.17.0 ==================================#
# context 2.2.1 | macos/arm64 | ocaml-option-flambda.1 ocaml-variants.5.3.0+options | https://opam.ocaml.org#fa0e8c74bf53d0b4373e7cf144e08b669d2d1970
# path ~/.opam/5.3.0-flambda/.opam-switch/build/core_unix.v0.17.0
# command ~/.opam/opam-init/hooks/sandbox.sh build dune build -p core_unix -j 7
# exit-code 1
# env-file ~/.opam/log/core_unix-53446-b53dc2.env
# output-file ~/.opam/log/core_unix-53446-b53dc2.out
### output ###
# [...]
# (cd _build/default && /Users/andretampubolon/.opam/5.3.0-flambda/bin/ocamlopt.opt -w -40 -g -a -o time_ns_unix/src/time_ns_unix.cmxa time_ns_unix/src/.time_ns_unix.objs/native/time_ns_unix__.cmx time_ns_unix/src/.time_ns_unix.objs/native/time_ns_unix__Time_ns_unix_intf.cmx time_ns_unix/src/.time_ns_unix.objs/native/time_ns_unix.cmx)
# ar: error: couldn't create cache file '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-LfkfM8DO' (errno=Operation not permitted)
# ar: error: couldn't create cache file '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-3YSaI2pV' (errno=Operation not permitted)
# (cd _build/default && /Users/andretampubolon/.opam/5.3.0-flambda/bin/ocamlopt.opt -w -40 -g -a -o interval_unix/src/interval_unix.cmxa interval_unix/src/.interval_unix.objs/native/interval_unix__.cmx interval_unix/src/.interval_unix.objs/native/interval_unix__Interval_unix_intf.cmx interval_unix/src/.interval_unix.objs/native/interval_unix.cmx)
# ar: error: couldn't create cache file '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-8dKreaZZ' (errno=Operation not permitted)
# ar: error: couldn't create cache file '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-xIswM1LF' (errno=Operation not permitted)
# (cd _build/default && /Users/andretampubolon/.opam/5.3.0-flambda/bin/ocamlopt.opt -w -40 -g -a -o linux_ext/src/linux_ext.cmxa -cclib -llinux_ext_stubs linux_ext/src/.linux_ext.objs/native/linux_ext__.cmx linux_ext/src/.linux_ext.objs/native/linux_ext__Epoll_intf.cmx linux_ext/src/.linux_ext.objs/native/linux_ext__Epoll.cmx linux_ext/src/.linux_ext.objs/native/linux_ext__Linux_ext_intf.cmx li[...]
# ar: error: couldn't create cache file '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-c4EMaJ9Z' (errno=Operation not permitted)
# ar: error: couldn't create cache file '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-BpO9aCrI' (errno=Operation not permitted)
# (cd _build/default && /Users/andretampubolon/.opam/5.3.0-flambda/bin/ocamlopt.opt -w -40 -g -a -o lock_file_blocking/src/lock_file_blocking.cmxa lock_file_blocking/src/.lock_file_blocking.objs/native/lock_file_blocking.cmx)
# ar: error: couldn't create cache file '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-1AowZdTq' (errno=Operation not permitted)
# ar: error: couldn't create cache file '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-CuvZyXGT' (errno=Operation not permitted)
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><> 🐫
┌─ The following actions failed
│ λ build core_unix v0.17.0
└─
A few questions:
# (cd _build/default && /Users/andretampubolon/.opam/5.3.0-flambda/bin/ocamlopt.opt -w -40 -g -a -o linux_ext/src/linux_ext.cmxa -cclib -llinux_ext_stubs linux_ext/src/.linux_ext.objs/native/linux_ext__.cmx linux_ext/src/.linux_ext.objs/native/linux_ext__Epoll_intf.cmx linux_ext/src/.linux_ext.objs/native/linux_ext__Epoll.cmx linux_ext/src/.linux_ext.objs/native/linux_ext__Linux_ext_intf.cmx li[...]
I’m on macOS… but why these Linux-related line appear? Hmm not sure.
# ar: error: couldn't create cache file '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-LfkfM8DO' (errno=Operation not permitted)
# ar: error: couldn't create cache file '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-3YSaI2pV' (errno=Operation not permitted)
Not sure if write permission issue is the cause. Manually creating the file works, e.g
$ touch '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-3YSaI2pV'
and my macOS account is non-admin. Any working solution for this problem?
I can’t speak directly to this myself, but I did see this thread recently which seems relevant. Might be worth a look.
Hello OCaml community,
I try to install core_unix on my Mac Book air M1 2020 macos Version 15.4
I get this error:
[ERROR] The compilation of core_unix.v0.17.0 failed at "dune build -p core_unix -j 7".
#=== ERROR while compiling core_unix.v0.17.0 ==================================#
# context 2.3.0 | macos/arm64 | ocaml.5.3.0 | https://opam.ocaml.org#1b767795a4e028a4d45f916f1598c24ee7a7b6cb
# path ~/.opam/default/.opam-switch/build/core_unix.v0.17.0
# command ~/.opam/opam-init/h…
It looks like Xcode got an update recently. I was also able to reproduce locally.
I was able to fix it by applying the following change to ~/.opam/opam-init/hooks/sandbox.sh
:
diff --git a/src/state/shellscripts/sandbox_exec.sh b/src/state/shellscripts/sandbox_exec.sh
index 0703721f3..6b27563db 100644
--- a/src/state/shellscripts/sandbox_exec.sh
+++ b/src/state/shellscripts/sandbox_exec.sh
@@ -7,7 +7,7 @@ set -ue
POL='(version 1)(allow default)(deny network*)(deny file-write*)'
POL="$POL"'(allow network* (remote unix))'
POL="$POL"'(allow file-write* (literal "/dev/null") (literal "/dev/dtracehelper"))'
-POL="$POL"'(allow file-write* (regex #"^(/private)?(/var)?/tmp/"))'
+POL="$POL"'(allow file-write* (regex #"^(/private)?(/var)?/tmp/" #"^(/private)?/var/folders/" #"^(/private)?/var/db/mds/"))'
add_mounts() {
if [ -d "$2" ]; then
This is a copy of what macports does . I’m not entirely sure if it makes the sandbox too permissive or not (previous discussions and bug-reports to Apple were inconclusive) but it looks like we’ll need to apply something of the sort and make a point release of opam tomorrow to fix that.
anta40
April 10, 2025, 4:36am
4
Just updated to XCode 16.3 few days ago. Your suggestion fixed the “ar: error: couldn’t create cache file…”. But introduced another error:
⬇ retrieved async_log.v0.17.0 (cached)
⬇ retrieved async_unix.v0.17.0 (cached)
⬇ retrieved async.v0.17.0 (cached)
⬇ retrieved textutils.v0.17.0 (cached)
⬇ retrieved core_unix.v0.17.0 (cached)
[ERROR] The compilation of core_unix.v0.17.0 failed at "dune build -p core_unix -j 7".
#=== ERROR while compiling core_unix.v0.17.0 ==================================#
# context 2.2.1 | macos/arm64 | ocaml-option-flambda.1 ocaml-variants.5.3.0+options | https://opam.ocaml.org#fa0e8c74bf53d0b4373e7cf144e08b669d2d1970
# path ~/.opam/5.3.0-flambda/.opam-switch/build/core_unix.v0.17.0
# command ~/.opam/opam-init/hooks/sandbox.sh build dune build -p core_unix -j 7
# exit-code 1
# env-file ~/.opam/log/core_unix-8370-a9fa73.env
# output-file ~/.opam/log/core_unix-8370-a9fa73.out
### output ###
# ./thread_id.h:12:23: note: expanded from macro 'GET_THREAD_ID'
# [...]
# /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/unistd.h:744:6: note: 'syscall' has been explicitly marked deprecated here
# 744 | int syscall(int, ...);
# | ^
# 4 warnings generated.
# (cd _build/default/unix_pseudo_terminal/src && /bin/bash -e -u -o pipefail -c './discover.sh config_ext.h /Users/andretampubolon/.opam/5.3.0-flambda/lib/jst-config/config.h')
# getconf: no such configuration parameter `GNU_LIBC_VERSION'
# (cd _build/default && /Users/andretampubolon/.opam/5.3.0-flambda/bin/ocamlopt.opt -w -40 -g -I time_float_unix/time_unix/.time_unix.objs/byte -I time_float_unix/time_unix/.time_unix.objs/native -I /Users/andretampubolon/.opam/5.3.0-flambda/lib/base -I /Users/andretampubolon/.opam/5.3.0-flambda/lib/base/base_internalhash_types -I /Users/andretampubolon/.opam/5.3.0-flambda/lib/base/md5 -I /User[...]
# File "time_float_unix/time_unix/time_unix.ml", line 1, characters 4-14:
# 1 | [@@@deprecated "[since 2022-04] Use [Time_float_unix] instead"]
# ^^^^^^^^^^
# Warning 53 [misplaced-attribute]: the "deprecated" attribute cannot appear in this context
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><> 🐫
┌─ The following actions failed
│ λ build core_unix v0.17.0
└─
Hmmm perhaps I’ll try downgrading OCaml…
Yes, core_unix
isn’t currently available on arm64 with OCaml 5.3 (see janestreet/core_unix#14 ). I’m not sure why nobody encoded that in the package in opam-repository so i’ve done it in ocaml/opam-repository#27742 . Once this is merged, opam will now tell you that the package is unavailable on that platform
anta40
April 12, 2025, 4:17pm
6
I see. On other hand, no issue installing base, async etc on OCaml 5.2. Guess I’ll stick with it until Janestreet devs fix the issue properly.
anta40
April 13, 2025, 1:48pm
7
Out of curiosity, I installed OCaml 5.3.0, and then async (base works fine). New error messages:
$ opam install async
[ERROR] Package conflict!
* No agreement on the version of ocaml-variants:
- (invariant) → ocaml-variants = 5.3.0+options
- async → core_kernel < v0.14 → ocaml < 4.12.0 → ocaml-variants < 4.10.3~
You can temporarily relax the switch invariant with `--update-invariant'
* Missing dependency:
- async → core < v0.16 → ocaml < 4.12.0 → ocaml-base-compiler = 4.10.0 | ocaml-system >= 4.10.0 | ocaml-variants < 4.10.1~
unmet availability conditions: '!(os = "macos" & arch = "arm64")'
unmet availability conditions, e.g. 'sys-ocaml-version = "4.10.0"'
unmet availability conditions, e.g. '!(os = "macos" & arch = "arm64")'
* Missing dependency:
- async → core < v0.16 → ocaml < 4.12.0 → ocaml-base-compiler = 4.10.1 | ocaml-system >= 4.10.1 | ocaml-variants < 4.10.2~
unmet availability conditions: '!(os = "macos" & arch = "arm64")'
unmet availability conditions, e.g. 'sys-ocaml-version = "4.10.1"'
unmet availability conditions, e.g. '!(os = "macos" & arch = "arm64")'
* Missing dependency:
- async → core_kernel < v0.13 → base < v0.13 → ocaml < 4.10.0 → ocaml-base-compiler < 3.07+1 | ocaml-system < 3.07+1 | ocaml-variants < 3.8~
unmet availability conditions: 'arch != "arm64" & arch != "arm32" & arch != "ppc64"'
unmet availability conditions: 'sys-ocaml-version = "3.07"'
no matching version
* Missing dependency:
- async → core_kernel < v0.13 → base < v0.13 → ocaml < 4.10.0 → ocaml-base-compiler = 3.07+1 | ocaml-system = 3.07+1 | ocaml-variants < 3.8~
unmet availability conditions: 'arch != "arm64" & arch != "arm32" & arch != "ppc64"'
unmet availability conditions: 'sys-ocaml-version = "3.07+1"'
no matching version
* Missing dependency:
- async → core_kernel < v0.13 → base < v0.13 → ocaml < 4.10.0 → ocaml-base-compiler = 3.07+2 | ocaml-system = 3.07+2 | ocaml-variants < 3.8~
unmet availability conditions: 'arch != "arm64" & arch != "arm32" & arch != "ppc64"'
unmet availability conditions: 'sys-ocaml-version = "3.07+2"'
no matching version
* Missing dependency:
- async → core_kernel < v0.13 → base < v0.13 → ocaml < 4.10.0 → ocaml-base-compiler = 3.08.0 | ocaml-system >= 3.08.0 | ocaml-variants < 3.08.1~
unmet availability conditions: 'arch != "arm64" & arch != "arm32" & arch != "ppc64"'
unmet availability conditions, e.g. 'sys-ocaml-version = "3.08.0"'
no matching version
* Missing dependency:
- async → core_kernel < v0.13 → base < v0.13 → ocaml < 4.10.0 → ocaml-base-compiler = 3.08.1 | ocaml-system >= 3.08.1 | ocaml-variants < 3.08.2~
unmet availability conditions: 'arch != "arm64" & arch != "arm32" & arch != "ppc64"'
unmet availability conditions, e.g. 'sys-ocaml-version = "3.08.1"'
no matching version
* Missing dependency:
- async → core_kernel < v0.13 → base < v0.13 → ocaml < 4.10.0 → ocaml-base-compiler = 3.08.2 | ocaml-system >= 3.08.2 | ocaml-variants < 3.08.3~
unmet availability conditions: 'arch != "arm64" & arch != "arm32" & arch != "ppc64"'
unmet availability conditions, e.g. 'sys-ocaml-version = "3.08.2"'
no matching version
* Missing dependency:
- async → core_kernel < v0.13 → base < v0.13 → ocaml < 4.10.0 → ocaml-base-compiler = 3.08.3 | ocaml-system >= 3.08.3 | ocaml-variants < 3.08.4~
unmet availability conditions: 'arch != "arm64" & arch != "arm32" & arch != "ppc64"'
unmet availability conditions, e.g. 'sys-ocaml-version = "3.08.3"'
no matching version
....
....
...
Oh well
mseri
April 14, 2025, 6:54am
8
I agree that the error message is not helpful. It stems from the incompatibility of core_unix with ocaml 5.3 mentioned above and merged as `core_unix.v0.17.0` does not build on OCaml 5.3 by Leonidas-from-XIV · Pull Request #27737 · ocaml/opam-repository · GitHub
mseri
April 15, 2025, 9:22am
9
We just merged the core_unix v0.17.1 release that fixes this issue. If you point at the git opam-repository url, you can already run opam update
and use it. Otherwise it should be available within a few hours
2 Likes
anta40
April 15, 2025, 3:49pm
10
Yep, upgrading core_unix to 0.17.1 solves the async installation issue.