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

[BUG] Fatal error: exception Failure("of_int_exn") when compiling JSOO in 32bit OCaml switch. #1697

Closed
ejgallego opened this issue Sep 30, 2024 · 6 comments · Fixed by #1699
Labels

Comments

@ejgallego
Copy link
Contributor

ejgallego commented Sep 30, 2024

Likely due to #1693 , see log at coq-lsp CI for the build failure log, the CI there is pinned to JSOO master branch due to other fixes so this is how I came to detect this bug:

#=== ERROR while compiling js_of_ocaml-compiler.5.8.2 =========================#
# context     2.1.6 | linux/x86_64 | ocaml-option-32bit.1 ocaml-variants.4.14.2+options | pinned(git+https://github.com/ocsigen/js_of_ocaml.git#57126b5542fb6db8515fb33c121d1eaf56a1c780)
# path        ~/work/coq-lsp/coq-lsp/_opam/.opam-switch/build/js_of_ocaml-compiler.5.8.2
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p js_of_ocaml-compiler -j 4 @install
# exit-code   1
# env-file    ~/.opam/log/js_of_ocaml-compiler-16058-4655a0.env
# output-file ~/.opam/log/js_of_ocaml-compiler-16058-4655a0.out
### output ###
# File "compiler/lib-runtime-files/dune", lines 6-14, characters 0-140:
#  6 | (rule
#  7 |  (target files.ml)
#  8 |  (deps
#  9 |   gen/gen.exe
# 10 |   (glob_files ../../runtime/*.js))
# 11 |  (action
# 12 |   (with-stdout-to
# 13 |    %{target}
# 14 |    (run %{deps}))))
# (cd _build/default/compiler/lib-runtime-files && gen/gen.exe ../../runtime/array.js ../../runtime/backtrace.js ../../runtime/bigarray.js ../../runtime/bigstring.js ../../runtime/blake2.js ../../runtime/compare.js ../../runtime/domain.js ../../runtime/dynlink.js ../../runtime/effect.js ../../runtime/fail.js ../../runtime/format.js ../../runtime/fs.js ../../runtime/fs_fake.js ../../runtime/fs_node.js ../../runtime/gc.js ../../runtime/graphics.js ../../runtime/hash.js ../../runtime/ieee_754.js ../../runtime/int64.js ../../runtime/internalMod.js ../../runtime/ints.js ../../runtime/io.js ../../runtime/jslib.js ../../runtime/jslib_js_of_ocaml.js ../../runtime/lexing.js ../../runtime/marshal.js ../../runtime/md5.js ../../runtime/mlBytes.js ../../runtime/nat.js ../../runtime/obj.js ../../runtime/parsing.js ../../runtime/prng.js ../../runtime/runtime_events.js ../../runtime/stdlib.js ../../runtime/stdlib_modern.js ../../runtime/str.js ../../runtime/sync.js ../../runtime/sys.js ../../runtime/toplevel.js ../../runtime/unix.js ../../runtime/weak.js ../../runtime/zstd.js) > _build/default/compiler/lib-runtime-files/files.ml
# Fatal error: exception Failure("of_int_exn")
@ejgallego ejgallego added the bug label Sep 30, 2024
@ejgallego
Copy link
Contributor Author

Edit, installed locally, here is the backtrace:

Raised at Stdlib.failwith in file "stdlib.ml", line 29, characters 17-33
Called from Js_of_ocaml_compiler__Mlvalue.Block.make in file "compiler/lib/mlvalue.ml", line 38, characters 56-82
Called from Js_of_ocaml_compiler__Js_traverse.map#expression_o in file "compiler/lib/js_traverse.ml", line 391, characters 23-39
Called from Js_of_ocaml_compiler__Js_traverse.map#statement in file "compiler/lib/js_traverse.ml", line 190, characters 47-65
Called from Js_of_ocaml_compiler__Js_traverse.map#statements.(fun) in file "compiler/lib/js_traverse.ml", line 102, characters 56-69
Called from Js_of_ocaml_compiler__Stdlib.List.count_map in file "compiler/lib/stdlib.ml", line 138, characters 17-21
Called from Js_of_ocaml_compiler__Js_traverse.map#fun_decl in file "compiler/lib/js_traverse.ml", line 120, characters 41-61
Called from Js_of_ocaml_compiler__Js_traverse.map#expression in file "compiler/lib/js_traverse.ml", line 322, characters 23-42
Called from Js_of_ocaml_compiler__Js_traverse.map#expression in file "compiler/lib/js_traverse.ml", line 284, characters 54-69
Called from Js_of_ocaml_compiler__Js_traverse.map#statement in file "compiler/lib/js_traverse.ml", line 151, characters 55-71
Called from Js_of_ocaml_compiler__Js_traverse.map#statements.(fun) in file "compiler/lib/js_traverse.ml", line 102, characters 56-69
Called from Js_of_ocaml_compiler__Stdlib.List.count_map in file "compiler/lib/stdlib.ml", line 143, characters 17-21
Called from Js_of_ocaml_compiler__Stdlib.List.count_map in file "compiler/lib/stdlib.ml", line 157, characters 63-88
Called from Js_of_ocaml_compiler__Stdlib.List.count_map in file "compiler/lib/stdlib.ml", line 157, characters 63-88
Called from Js_of_ocaml_compiler__Stdlib.List.count_map in file "compiler/lib/stdlib.ml", line 157, characters 63-88
Called from Js_of_ocaml_compiler__Macro.f in file "compiler/lib/macro.ml", line 77, characters 11-26
Called from Js_of_ocaml_compiler__Linker.Fragment.analyze in file "compiler/lib/linker.ml", line 220, characters 30-73
Called from Js_of_ocaml_compiler__Stdlib.List.count_map in file "compiler/lib/stdlib.ml", line 149, characters 17-21
Called from Dune__exe__Gen.(fun) in file "compiler/lib-runtime-files/gen/gen.ml", line 62, characters 38-87
Called from Js_of_ocaml_compiler__Stdlib.List.count_map in file "compiler/lib/stdlib.ml", line 150, characters 17-21
Called from Js_of_ocaml_compiler__Stdlib.List.count_map in file "compiler/lib/stdlib.ml", line 157, characters 63-88
Called from Js_of_ocaml_compiler__Stdlib.List.count_map in file "compiler/lib/stdlib.ml", line 157, characters 63-88
Called from Dune__exe__Gen in file "compiler/lib-runtime-files/gen/gen.ml", line 62, characters 8-88

@hhugo
Copy link
Member

hhugo commented Sep 30, 2024

We should probably add a 32bit switch to the CI

@ejgallego
Copy link
Contributor Author

Fail seems to happen at return BLOCK( in fs_node.js.

@ejgallego
Copy link
Contributor Author

ejgallego commented Sep 30, 2024

Not sure what is going on, but tag = 0 makes the code in Targetint fail. Targetint.num_bits reports 32 in this case.

@hhugo
Copy link
Member

hhugo commented Sep 30, 2024

Fixed in #1699

@ejgallego
Copy link
Contributor Author

Thanks! CI for 32 bit should be happening in #1698 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants