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

Unable to build with OCaml 4.14, receive SIGBUS #12

Open
zbaylin opened this issue Jan 8, 2024 · 3 comments
Open

Unable to build with OCaml 4.14, receive SIGBUS #12

zbaylin opened this issue Jan 8, 2024 · 3 comments

Comments

@zbaylin
Copy link

zbaylin commented Jan 8, 2024

When trying to build metapp (both master and 0.4.4), I'm receiving a SIGBUS during (what I presume is) the metapp.ppx step of the process.

This is on macOS 14.2.1 and XCode 15.1.

Steps to reproduce

  • clone the repo
  • run opam install ocaml-base-compiler.4.14.1
  • run opam install . --deps-only
  • run dune build --versbose

When doing the above, I get the following output:

File "metapp/dune", line 3, characters 14-46:
3 |   (preprocess (pps ppxlib.metaquot metapp.ppx))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Command [1] got signal BUS:
$ (cd _build/default && .ppx/f04423e293bc7238bf6fa2027578cb58/ppx.exe --cookie 'library-name="metapp"' -o metapp/metapp.pp.ml --impl metapp/metapp.ml -corrected-suffix .ppx-corrected -diff-cmd - -dump-ast)
@zbaylin
Copy link
Author

zbaylin commented Jan 8, 2024

Interestingly, this seems like it might be a bug in ppxlib. The backtrace looks like:

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=257, address=0x7a2f73726573552f)
  * frame #0: 0x000073726573552f
    frame #1: 0x0000000100f4bbd4 metapp_version_info.cmxs`caml_apply11 + 124
    frame #2: 0x0000000100111288 ppx.exe`camlPpxlib_ast__Ast_helper_lite__code_begin + 144
    frame #3: 0x000000010050af74 ppx.exe`caml_callback [inlined] caml_callback_exn(closure=<unavailable>, arg=<unavailable>) at callback.c:111:10 [opt]
    frame #4: 0x000000010050af5c ppx.exe`caml_callback(closure=<unavailable>, arg=0) at callback.c:165:34 [opt]
    frame #5: 0x000000010050fd98 ppx.exe`caml_natdynlink_run(handle_v=<unavailable>, symbol=<unavailable>) at dynlink_nat.c:128:36 [opt]
    frame #6: 0x00000001005154e8 ppx.exe`caml_call_gc + 352

@zbaylin
Copy link
Author

zbaylin commented Jan 8, 2024

Okay not as sure about that anymore, it might have just been a faulty llvm trace -- caml_call_gc + 352 doesn't seem to point anywhere useful. The natdynlink stuff though does seem relevant, since I noticed https://github.com/thierry-martinez/metapp/blob/master/ppx/findlib_for_ppx.ml has a decent amount of Dynlink stuff in it. I wonder if something in there is the culprit? I'll do some more research.

@jonahbeckford
Copy link
Contributor

I had the same error with OCaml 4.14.0 + 4.14.1 on macOS arm64 using the following compilers:

  • dkml-base-compiler.4.14.0
  • ocaml-base-compiler.4.14.0
  • ocaml-base-compiler.4.14.1

I upgraded to ocaml-base-compiler.4.14.2 and the SIGBUS went away.

In an odd coincidence, I ran into an error at the same location very recently in ocaml-ppx/ppxlib#466 (section "Initial Attempt. OUTDATED and FIXED"). It was almost the same except then I did not receive a SIGBUS, but I was using bytecode so that wasn't surprising. And that older problem had an easy root cause.

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

No branches or pull requests

2 participants