janestreet / base

Standard library for OCaml
MIT License
848 stars 124 forks source link

Unable to build v0.15~preview.125.13+424 #125

Closed KeenWill closed 2 years ago

KeenWill commented 2 years ago

Hello!

I am trying to install base.v0.15~preview.125.13+424 on a fresh system and I am encountering the following error:

#16 53.69 [ERROR] The compilation of base.v0.15~preview.125.13+424 failed at "dune build -p base -j 5".
#16 53.69 
#16 53.69 #=== ERROR while compiling base.v0.15~preview.125.13+424 ======================#
#16 53.69 # context              2.1.0 | linux/x86_64 | ocaml-base-compiler.4.13.1 | https://ocaml.janestreet.com/opam-repository
#16 53.69 # path                 ~/.opam/4.13.1/.opam-switch/build/base.v0.15~preview.125.13+424
#16 53.69 # command              ~/.opam/4.13.1/bin/dune build -p base -j 5
#16 53.69 # exit-code            1
#16 53.69 # env-file             ~/.opam/log/base-7-c3f187.env
#16 53.69 # output-file          ~/.opam/log/base-7-c3f187.out
#16 53.69 ### output ###
#16 53.69 #          gen shadow-stdlib/src/shadow_stdlib.mli (exit 2)
#16 53.69 # (cd _build/default/shadow-stdlib/src && ../gen/gen.exe -caml-cmi ../../compiler-stdlib/src/.caml.objs/caml.cmi ../../compiler-stdlib/src/.caml.objs/byte/caml.cmi -o shadow_stdlib.mli)
#16 53.69 # Fatal error: exception Failure("no equivalent for symbol \"acosh\"")

I am observing this behavior happens on both Ubuntu Focal and MacOS 12.1. The compiler I am using OCaml 4.13.1.

bcc32 commented 2 years ago

Hi @KeenWill, does this failure happen on OCaml 4.12? That's the version we're currently using internally. If it works for you on 4.12, this issue will likely be fixed as we update to 4.13.

jamesjer commented 2 years ago

I ran into this problem also while attempting to build base 0.15.0 for Fedora Rawhide, where we have OCaml 4.13.1. I added the following to val_replacement in shadow-stdlib/gen/mapper.mll:

  | "acosh"               -> Repl "Float.acosh"
  | "asinh"               -> Repl "Float.asinh"
  | "atanh"               -> Repl "Float.atanh"

Following that, the next build attempt ended like this:

$ dune build
File "src/float.ml", line 490, characters 10-52:
490 |   let t = (round_nearest [@ocaml.inlined always]) t0 in
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error (warning 55 [inlining-impossible]): Cannot inline: Function information unavailable

I added (flags :standard -w -55) to src/dune, and then the build completed.

ghost commented 2 years ago

I was experiencing this same issue with version 4.14. Looking through the changelog for 4.13:

- #944: Add some missing C99 float operations. Stdlib now contains the inverse hyperbolic functions acosh, asinh, and atanh.

So I believe that explains why the mapper.mll file now requires these to be handled in order to produce shadow_stdlib.mli (which as far as I can tell is a generated in order to add useful deprecation comments to the stdlib interface).

As far as the other error goes I'm a bit stumped but I note that the following compiles:

# line 489 src/float.ml
let round_nearest t0 = round_nearest t0 

let int63_round_nearest_portable_alloc_exn t0 =
  let t = (round_nearest [@ocaml.inlined always]) t0 in
bcc32 commented 2 years ago

I believe this issue is fixed by caae3c2bacebd558ae2b0bbea807ec9703fb7508, so I'm closing. Please reopen if it doesn't work.