Can't install on macOS M1 (unmet availability conditions)
leostera opened this issue · 8 comments
When trying to install I'm getting a constraint error that @kayceesrk says shouldn't be an issue. This might just be lifting the constraint from the opam file.
; opam install runtime_events_tools.0.5.0
[ERROR] runtime_events_tools = 0.5.0 unmet availability conditions: 'arch != "arm64" &
arch != "arm32" & os != "freebsd"'
Looks like this is a known failure on arm: https://opam.ci.ocaml.org/github/ocaml/opam-repository/commit/09848e221e89330464a485f549aad12c2ad20a87/variant/extras,arm64-ocaml-5.1,runtime_events_tools.0.5.0,tests
Needs investigation.
Luckily it fails in the same way on linux arm64 and macOS arm64, including the error from ocaml-ci since those those logs do expire after a while.
/: (run (shell "cd ./src && opam exec -- dune build @install @check @runtest && rm -rf _build"))
File "test/dune", line 7, characters 0-109:
7 | (rule
8 | (alias runtest)
9 | (deps
10 | (alias olly)
11 | ocaml.mly)
12 | (action
13 | (run olly gc-stats "menhir ocaml.mly")))
(cd _build/default/test && ../../install/default/bin/olly gc-stats 'menhir ocaml.mly')
Uncaught exception:
(Invalid_argument
"Float.iround_nearest_exn: argument (nan) is too small or NaN")
Raised at Stdlib.invalid_arg in file "stdlib.ml", line 30, characters 20-45
Called from Base__Float.iround_nearest_exn_64 in file "src/float.ml" (inlined), line 360, characters 4-89
Called from Base__Float.int63_round_nearest_arch64_noalloc_exn in file "src/float.ml", line 514, characters 60-82
Called from Time_stamp_counter.Calibrator.calibrate_using in file "time_stamp_counter/src/time_stamp_counter.ml" (inlined), line 277, characters 7-69
Called from Time_stamp_counter.Calibrator.initialize.(fun) in file "time_stamp_counter/src/time_stamp_counter.ml", line 285, characters 6-56
Called from Base__List0.iter in file "src/list0.ml", line 60, characters 4-7
Called from Time_stamp_counter.Calibrator.create_using in file "time_stamp_counter/src/time_stamp_counter.ml", line 322, characters 4-24
Called from CamlinternalLazy.do_force_block in file "camlinternalLazy.ml", line 49, characters 17-27
Re-raised at CamlinternalLazy.do_force_block in file "camlinternalLazy.ml", line 56, characters 4-11
Called from Tracing_zero__Writer.new_buf_every in file "zero/writer.ml", line 73, characters 16-53
"/usr/bin/env" "bash" "-c" "cd ./src && opam exec -- dune build @install @check @runtest && rm -rf _build" failed with exit status 1
For extra context this error also occurs on Linux/ARM64 which suggests to me that it is an ARM issue rather than an OS problem.
I have tracked this down to a missing implementation of rdtsc
in ocaml_intrinsics, causing a floating point Nan to get used in calculations. An implementation is provided in janestreet/ocaml_intrinsics@f078dcb which is not release onto opam yet. Perhaps a backport of it could be released as ocaml_intrinsics.v.0.16.1
?
I have created a version of ocaml_intrinsics.v.0.16.0 plus that change cherry picked onto it.
So if you pin to that version using opam pin -n git+https://github.com/tmcgilchrist/ocaml_intrinsics.git#v0.16 --with-version=v0.16.0
then runtime_event_tools will work on ARM64 for both Linux and MacOS.
This fix has been tested on macOS Sonoma and Ubuntu:23.10.
Thanks for the detective work. Is it the case that ocaml_intrinsics
with this fix hasn't been released yet?
That is correct. A bug fix with the commit I mentioned would solve the MacOS problem.
The larger issue for runtime_events_tools
is that ideally we want to support all Tier-1 platforms. To get PPC64, RiscV and s390x working we need to provide similar implementations for the equivalent assembly instruction, which I've started doing on janestreet/ocaml_intrinsics@master...tmcgilchrist:ocaml_intrinsics:ppc64
#39 for a 0.5.1 release when ocaml_intrinsics.v0.16.1 is ready
0.5.1 release is in opam-repository it fixes macOS and linux on ARM. Please test that and report any issues found @leostera