rust-bindgen
rust-bindgen copied to clipboard
Panic: Couldn't resolve constant type, and it wasn't an nondeductible auto type or unexposed type!
Input C/C++ Header
The original header is from Julia 1.10.
_Atomic(int) a;
Bindgen Invocation
The original build.rs is in https://github.com/Kriskras99/julia-rs/blob/master/julia-sys/build.rs
bindgen::Builder::default()
.header("wrapper.h")
.clang_arg(format!("-I{include_dir}"))
.allowlist_recursively(false)
.allowlist_item("_*[Jj][Ll].*")
.allowlist_type("_bigval_t")
.allowlist_type("_mallocarray_t")
.allowlist_type("arraylist_t")
.allowlist_type("arraylist_t")
.allowlist_type("bool_t")
.allowlist_type("bufmode_t")
.allowlist_type("bufstate_t")
.allowlist_type("bufstate_t")
.allowlist_type("htable_t")
.allowlist_type("ios_t")
.allowlist_type("pthread_t")
.allowlist_type("sig_atomic_t")
.allowlist_type("sigjmp_buf")
.allowlist_type("small_arraylist_t")
.allowlist_type("uv_file")
.allowlist_type("uv_handle_t")
.allowlist_type("uv_handle_s")
.allowlist_type("uv_handle_type")
.allowlist_type("uv_loop_s")
.allowlist_type("uv_loop_t")
.allowlist_type("uv_stream_t")
.allowlist_type("uv_stream_s")
.allowlist_type("uv_tcp_t")
.allowlist_type("ws_queue_t")
.allowlist_type("ws_array_t")
.allowlist_function("arraylist_grow")
.allowlist_function("pthread_self")
.blocklist_function("jl_vprintf")
.blocklist_function("jl_vexceptionf")
.opaque_type("uv_.*")
.opaque_type("sigjmp_buf")
.opaque_type("sig_atomic_t")
.opaque_type("_jl_typemap_entry_t")
.opaque_type("_jl_binding_t")
.opaque_type("_jl_code_instance_t")
.opaque_type("_jl_sym_t")
.generate()
.unwrap()
Actual Results
error: failed to run custom build command for `julia-sys v0.3.0 (/home/kriskras99/Source/julia-rs/julia-sys)`
Caused by:
process didn't exit successfully: `/home/kriskras99/Source/julia-rs/target/debug/build/julia-sys-76c4fc57231cb78c/build-script-build` (signal: 6, SIGABRT: process abort signal)
--- stdout
cargo:rustc-link-lib=julia
cargo:rustc-link-search=native=/home/kriskras99/.julia/juliaup/julia-1.10.4+0.x64.linux.gnu/lib
--- stderr
thread 'main' panicked at /home/kriskras99/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.69.4/ir/var.rs:323:25:
Couldn't resolve constant type, and it wasn't an nondeductible auto type or unexposed type!
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at core/src/panicking.rs:221:5:
panic in a function that cannot unwind
stack backtrace:
0: 0x5ad6f576299d - std::backtrace_rs::backtrace::libunwind::trace::hec5077cdfe44c6c8
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
1: 0x5ad6f576299d - std::backtrace_rs::backtrace::trace_unsynchronized::h865094a2efbb1f8a
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x5ad6f576299d - std::sys::backtrace::_print_fmt::h06c899f6b2d2e074
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/std/src/sys/backtrace.rs:66:9
3: 0x5ad6f576299d - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h581cab574f54050e
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/std/src/sys/backtrace.rs:39:26
4: 0x5ad6f578ad2b - core::fmt::rt::Argument::fmt::hb3bb35bec95a7f88
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/core/src/fmt/rt.rs:173:76
5: 0x5ad6f578ad2b - core::fmt::write::hea20c4aa5f041f7e
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/core/src/fmt/mod.rs:1178:21
6: 0x5ad6f575f773 - std::io::Write::write_fmt::hd099c2922ecaf59c
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/std/src/io/mod.rs:1823:15
7: 0x5ad6f5763b52 - std::sys::backtrace::BacktraceLock::print::h7cfdf342905e5a66
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/std/src/sys/backtrace.rs:42:9
8: 0x5ad6f5763b52 - std::panicking::default_hook::{{closure}}::h49e31294a5194c63
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/std/src/panicking.rs:266:22
9: 0x5ad6f57637be - std::panicking::default_hook::he3654a862c6c6eb0
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/std/src/panicking.rs:293:9
10: 0x5ad6f576444f - std::panicking::rust_panic_with_hook::h3cef95d46dcacec5
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/std/src/panicking.rs:797:13
11: 0x5ad6f5764103 - std::panicking::begin_panic_handler::{{closure}}::h97440388bbafeb8e
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/std/src/panicking.rs:664:13
12: 0x5ad6f5762e89 - std::sys::backtrace::__rust_end_short_backtrace::h768b229b3676f34a
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/std/src/sys/backtrace.rs:170:18
13: 0x5ad6f5763dc4 - rust_begin_unwind
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/std/src/panicking.rs:662:5
14: 0x5ad6f5788ff5 - core::panicking::panic_nounwind_fmt::runtime::h78cd90463aec586c
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/core/src/panicking.rs:112:18
15: 0x5ad6f5788ff5 - core::panicking::panic_nounwind_fmt::hc359218ac6f63168
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/core/src/panicking.rs:122:5
16: 0x5ad6f5789082 - core::panicking::panic_nounwind::h2d5df4fcddf4b0ac
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/core/src/panicking.rs:221:5
17: 0x5ad6f5789246 - core::panicking::panic_cannot_unwind::he747e2fe67af405b
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/core/src/panicking.rs:310:5
18: 0x5ad6f52796e7 - bindgen::clang::visit_children::habefd86bd7a29938
19: 0x78e939a72499 - <unknown>
20: 0x78e939a74349 - <unknown>
21: 0x78e939a746b0 - <unknown>
22: 0x78e939a71a14 - <unknown>
23: 0x78e939a75095 - clang_visitChildren
24: 0x5ad6f553860f - clang_sys::clang_visitChildren::h40f24c72e8b8561c
25: 0x5ad6f5277527 - bindgen::clang::Cursor::visit::hf695ca3f243757f4
26: 0x5ad6f52775eb - bindgen::clang::Cursor::visit_sorted::hea8d95dc7829d89c
27: 0x5ad6f523992e - bindgen::parse::{{closure}}::h72b683f3decf52e9
28: 0x5ad6f5336726 - bindgen::ir::context::BindgenContext::with_module::he4bd5df0b852f8e6
29: 0x5ad6f52396ae - bindgen::parse::h3209228cb34a0231
30: 0x5ad6f5236068 - bindgen::Bindings::generate::hac7c7ff4b4cd42ea
31: 0x5ad6f5233923 - bindgen::Builder::generate::h8c86f053db1b9afa
32: 0x5ad6f51e61ea - build_script_build::main::h1a7ec7d0a1eb23c0
33: 0x5ad6f51e50a3 - core::ops::function::FnOnce::call_once::h8c96e1f3d44d9bcd
34: 0x5ad6f51e4b66 - std::sys::backtrace::__rust_begin_short_backtrace::h83f1bac48850b914
35: 0x5ad6f51e4c59 - std::rt::lang_start::{{closure}}::h7721b5ec7e97eb71
36: 0x5ad6f575af00 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hb4e37f3f61cb3a71
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/core/src/ops/function.rs:284:13
37: 0x5ad6f575af00 - std::panicking::try::do_call::h4dc32b8affd11913
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/std/src/panicking.rs:554:40
38: 0x5ad6f575af00 - std::panicking::try::hdd6b996c64db6fe7
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/std/src/panicking.rs:518:19
39: 0x5ad6f575af00 - std::panic::catch_unwind::h1594e7500fa50c15
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/std/src/panic.rs:345:14
40: 0x5ad6f575af00 - std::rt::lang_start_internal::{{closure}}::hed1ed604644f8d3d
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/std/src/rt.rs:143:48
41: 0x5ad6f575af00 - std::panicking::try::do_call::hb70be2cd3842d30c
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/std/src/panicking.rs:554:40
42: 0x5ad6f575af00 - std::panicking::try::hd75a6aa7c082ac8c
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/std/src/panicking.rs:518:19
43: 0x5ad6f575af00 - std::panic::catch_unwind::hd7a2468bcb1eff19
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/std/src/panic.rs:345:14
44: 0x5ad6f575af00 - std::rt::lang_start_internal::hbc5c8d6a105c09f9
at /rustc/730d5d4095a264ef5f7c0a0781eea68c15431d45/library/std/src/rt.rs:143:20
45: 0x5ad6f51e4c37 - std::rt::lang_start::h535016826ca5cef7
46: 0x5ad6f51e6555 - main
47: 0x78e93b763e08 - <unknown>
48: 0x78e93b763ecc - __libc_start_main
49: 0x5ad6f51e23b5 - _start
50: 0x0 - <unknown>
thread caused non-unwinding panic. aborting.
Expected Results
I'm expecting this to work. It works on LLVM 7 (no panic, generated code works correctly). With LLVM 11, 14, and 18 the panic occurs. I have not tested other LLVM versions.
Notes
- LLVM 7 was tested in a CentOS 7 container
- LLVM 11 was tested in a Debian Bullseye container
- LLVM 14 was tested in a Debian Bookworm container
- LLVM 18 was tested on Arch Linux
This is a duplicate of #2151; atomics are not yet supported.
Is there an easy way to give the user a descriptive error? I couldn't find #2151 when searching for the panic message, so was very confused about why it was failing.