mozilla / cbindgen

A project for generating C bindings from Rust code
Mozilla Public License 2.0
2.37k stars 305 forks source link

Crash when binding rapier #770

Closed CrezyDud closed 5 months ago

CrezyDud commented 2 years ago

THeres a crash somewhere when binding rapier for c here's a log (don't know what else to say)

$ ~/.cargo/bin/cbindgen --config ~/.config/cbindgen.toml --lang c --crate rapier3d --output rapier.h
WARN: Skip rapier3d::INVALID_U32 - (not `pub`).
WARN: Skip rapier3d::INVALID_USIZE - (not `pub`).
WARN: Skip rapier3d::VERSION - (Unsupported expression. Macro(ExprMacro { attrs: [], mac: Macro { path: Path { leading_colon: None, segments: [PathSegment { ident: Ident(env), arguments: None }] }, bang_token: Bang, delimiter: Paren(Paren), tokens: TokenStream [Literal { lit: "CARGO_PKG_VERSION" }] } }))
WARN: Skip rapier3d::DEFAULT_CAPACITY - (not `pub`).
WARN: Skip rapier3d::DIRECTIONS - (not `pub`).
WARN: Skip rapier3d::START_FLAG_MASK - (not `pub`).
WARN: Skip rapier3d::PROXY_MASK - (not `pub`).
WARN: Skip rapier3d::START_SENTINEL_TAG - (not `pub`).
WARN: Skip rapier3d::END_SENTINEL_TAG - (not `pub`).
WARN: Skip rapier3d::NUM_SENTINELS - (not `pub`).
WARN: Skip rapier3d::NEXT_FREE_SENTINEL - (not `pub`).
WARN: Skip rapier3d::SENTINEL_VALUE - (not `pub`).
WARN: Skip rapier3d::DELETED_AABB_VALUE - (not `pub`).
WARN: Skip rapier3d::MAX_AABB_EXTENT - (not `pub`).
WARN: Skip rapier3d::REGION_WIDTH_BASE - (not `pub`).
WARN: Skip rapier3d::REGION_WIDTH_POWER_BASIS - (not `pub`).
WARN: Skip rapier3d::INV_EPSILON - (not `pub`).
thread 'main' panicked at 'ContactManifold is not generic', /home/kaktus/.cargo/registry/src/github.com-1ecc6299db9ec823/cbindgen-0.24.3/src/bindgen/ir/generic_path.rs:83:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[kaktus@wueste rapier]$ RUST_BACKTRACE=1 ~/.cargo/bin/cbindgen --config ~/.config/cbindgen.toml --lang c --crate rapier3d --output rapier.h
WARN: Skip rapier3d::INVALID_U32 - (not `pub`).
WARN: Skip rapier3d::INVALID_USIZE - (not `pub`).
WARN: Skip rapier3d::VERSION - (Unsupported expression. Macro(ExprMacro { attrs: [], mac: Macro { path: Path { leading_colon: None, segments: [PathSegment { ident: Ident(env), arguments: None }] }, bang_token: Bang, delimiter: Paren(Paren), tokens: TokenStream [Literal { lit: "CARGO_PKG_VERSION" }] } }))
WARN: Skip rapier3d::DEFAULT_CAPACITY - (not `pub`).
WARN: Skip rapier3d::DIRECTIONS - (not `pub`).
WARN: Skip rapier3d::START_FLAG_MASK - (not `pub`).
WARN: Skip rapier3d::PROXY_MASK - (not `pub`).
WARN: Skip rapier3d::START_SENTINEL_TAG - (not `pub`).
WARN: Skip rapier3d::END_SENTINEL_TAG - (not `pub`).
WARN: Skip rapier3d::NUM_SENTINELS - (not `pub`).
WARN: Skip rapier3d::NEXT_FREE_SENTINEL - (not `pub`).
WARN: Skip rapier3d::SENTINEL_VALUE - (not `pub`).
WARN: Skip rapier3d::DELETED_AABB_VALUE - (not `pub`).
WARN: Skip rapier3d::MAX_AABB_EXTENT - (not `pub`).
WARN: Skip rapier3d::REGION_WIDTH_BASE - (not `pub`).
WARN: Skip rapier3d::REGION_WIDTH_POWER_BASIS - (not `pub`).
WARN: Skip rapier3d::INV_EPSILON - (not `pub`).
thread 'main' panicked at 'ContactManifold is not generic', /home/kaktus/.cargo/registry/src/github.com-1ecc6299db9ec823/cbindgen-0.24.3/src/bindgen/ir/generic_path.rs:83:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
   2: cbindgen::bindgen::ir::generic_path::GenericParams::call
   3: <cbindgen::bindgen::ir::typedef::Typedef as cbindgen::bindgen::ir::item::Item>::instantiate_monomorph
   4: cbindgen::bindgen::ir::ty::Type::add_monomorphs
   5: cbindgen::bindgen::library::Library::generate
   6: cbindgen::bindgen::builder::Builder::generate
   7: cbindgen::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

RUST_BACKTRACE=full

$ ~/.cargo/bin/cbindgen --config ~/.config/cbindgen.toml --lang c --crate rapier3d --output rapier.h
WARN: Skip rapier3d::INVALID_U32 - (not `pub`).
WARN: Skip rapier3d::INVALID_USIZE - (not `pub`).
WARN: Skip rapier3d::VERSION - (Unsupported expression. Macro(ExprMacro { attrs: [], mac: Macro { path: Path { leading_colon: None, segments: [PathSegment { ident: Ident(env), arguments: None }] }, bang_token: Bang, delimiter: Paren(Paren), tokens: TokenStream [Literal { lit: "CARGO_PKG_VERSION" }] } }))
WARN: Skip rapier3d::DEFAULT_CAPACITY - (not `pub`).
WARN: Skip rapier3d::DIRECTIONS - (not `pub`).
WARN: Skip rapier3d::START_FLAG_MASK - (not `pub`).
WARN: Skip rapier3d::PROXY_MASK - (not `pub`).
WARN: Skip rapier3d::START_SENTINEL_TAG - (not `pub`).
WARN: Skip rapier3d::END_SENTINEL_TAG - (not `pub`).
WARN: Skip rapier3d::NUM_SENTINELS - (not `pub`).
WARN: Skip rapier3d::NEXT_FREE_SENTINEL - (not `pub`).
WARN: Skip rapier3d::SENTINEL_VALUE - (not `pub`).
WARN: Skip rapier3d::DELETED_AABB_VALUE - (not `pub`).
WARN: Skip rapier3d::MAX_AABB_EXTENT - (not `pub`).
WARN: Skip rapier3d::REGION_WIDTH_BASE - (not `pub`).
WARN: Skip rapier3d::REGION_WIDTH_POWER_BASIS - (not `pub`).
WARN: Skip rapier3d::INV_EPSILON - (not `pub`).
thread 'main' panicked at 'ContactManifold is not generic', /home/kaktus/.cargo/registry/src/github.com-1ecc6299db9ec823/cbindgen-0.24.3/src/bindgen/ir/generic_path.rs:83:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[kaktus@wueste rapier]$ RUST_BACKTRACE=1 ~/.cargo/bin/cbindgen --config ~/.config/cbindgen.toml --lang c --crate rapier3d --output rapier.h
WARN: Skip rapier3d::INVALID_U32 - (not `pub`).
WARN: Skip rapier3d::INVALID_USIZE - (not `pub`).
WARN: Skip rapier3d::VERSION - (Unsupported expression. Macro(ExprMacro { attrs: [], mac: Macro { path: Path { leading_colon: None, segments: [PathSegment { ident: Ident(env), arguments: None }] }, bang_token: Bang, delimiter: Paren(Paren), tokens: TokenStream [Literal { lit: "CARGO_PKG_VERSION" }] } }))
WARN: Skip rapier3d::DEFAULT_CAPACITY - (not `pub`).
WARN: Skip rapier3d::DIRECTIONS - (not `pub`).
WARN: Skip rapier3d::START_FLAG_MASK - (not `pub`).
WARN: Skip rapier3d::PROXY_MASK - (not `pub`).
WARN: Skip rapier3d::START_SENTINEL_TAG - (not `pub`).
WARN: Skip rapier3d::END_SENTINEL_TAG - (not `pub`).
WARN: Skip rapier3d::NUM_SENTINELS - (not `pub`).
WARN: Skip rapier3d::NEXT_FREE_SENTINEL - (not `pub`).
WARN: Skip rapier3d::SENTINEL_VALUE - (not `pub`).
WARN: Skip rapier3d::DELETED_AABB_VALUE - (not `pub`).
WARN: Skip rapier3d::MAX_AABB_EXTENT - (not `pub`).
WARN: Skip rapier3d::REGION_WIDTH_BASE - (not `pub`).
WARN: Skip rapier3d::REGION_WIDTH_POWER_BASIS - (not `pub`).
WARN: Skip rapier3d::INV_EPSILON - (not `pub`).
thread 'main' panicked at 'ContactManifold is not generic', /home/kaktus/.cargo/registry/src/github.com-1ecc6299db9ec823/cbindgen-0.24.3/src/bindgen/ir/generic_path.rs:83:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
   2: cbindgen::bindgen::ir::generic_path::GenericParams::call
   3: <cbindgen::bindgen::ir::typedef::Typedef as cbindgen::bindgen::ir::item::Item>::instantiate_monomorph
   4: cbindgen::bindgen::ir::ty::Type::add_monomorphs
   5: cbindgen::bindgen::library::Library::generate
   6: cbindgen::bindgen::builder::Builder::generate
   7: cbindgen::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[kaktus@wueste rapier]$ RUST_BACKTRACE=full ~/.cargo/bin/cbindgen --config ~/.config/cbindgen.toml --lang c --crate rapier3d --output rapier.h
WARN: Skip rapier3d::INVALID_U32 - (not `pub`).
WARN: Skip rapier3d::INVALID_USIZE - (not `pub`).
WARN: Skip rapier3d::VERSION - (Unsupported expression. Macro(ExprMacro { attrs: [], mac: Macro { path: Path { leading_colon: None, segments: [PathSegment { ident: Ident(env), arguments: None }] }, bang_token: Bang, delimiter: Paren(Paren), tokens: TokenStream [Literal { lit: "CARGO_PKG_VERSION" }] } }))
WARN: Skip rapier3d::DEFAULT_CAPACITY - (not `pub`).
WARN: Skip rapier3d::DIRECTIONS - (not `pub`).
WARN: Skip rapier3d::START_FLAG_MASK - (not `pub`).
WARN: Skip rapier3d::PROXY_MASK - (not `pub`).
WARN: Skip rapier3d::START_SENTINEL_TAG - (not `pub`).
WARN: Skip rapier3d::END_SENTINEL_TAG - (not `pub`).
WARN: Skip rapier3d::NUM_SENTINELS - (not `pub`).
WARN: Skip rapier3d::NEXT_FREE_SENTINEL - (not `pub`).
WARN: Skip rapier3d::SENTINEL_VALUE - (not `pub`).
WARN: Skip rapier3d::DELETED_AABB_VALUE - (not `pub`).
WARN: Skip rapier3d::MAX_AABB_EXTENT - (not `pub`).
WARN: Skip rapier3d::REGION_WIDTH_BASE - (not `pub`).
WARN: Skip rapier3d::REGION_WIDTH_POWER_BASIS - (not `pub`).
WARN: Skip rapier3d::INV_EPSILON - (not `pub`).
thread 'main' panicked at 'ContactManifold is not generic', /home/kaktus/.cargo/registry/src/github.com-1ecc6299db9ec823/cbindgen-0.24.3/src/bindgen/ir/generic_path.rs:83:9
stack backtrace:
   0:     0x5636d46b388d - std::backtrace_rs::backtrace::libunwind::trace::h22893a5306c091b4
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x5636d46b388d - std::backtrace_rs::backtrace::trace_unsynchronized::h29c3bc6f9e91819d
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x5636d46b388d - std::sys_common::backtrace::_print_fmt::he497d8a0ec903793
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x5636d46b388d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h9c2a9d2774d81873
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x5636d46d838c - core::fmt::write::hba4337c43d992f49
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/fmt/mod.rs:1194:17
   5:     0x5636d46b00d1 - std::io::Write::write_fmt::heb73de6e02cfabed
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/io/mod.rs:1655:15
   6:     0x5636d46b5345 - std::sys_common::backtrace::_print::h63c8b24acdd8e8ce
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x5636d46b5345 - std::sys_common::backtrace::print::h426700d6240cdcc2
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x5636d46b5345 - std::panicking::default_hook::{{closure}}::hc9a76eed0b18f82b
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:295:22
   9:     0x5636d46b4ff9 - std::panicking::default_hook::h2e88d02087fae196
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:314:9
  10:     0x5636d46b5892 - std::panicking::rust_panic_with_hook::habfdcc2e90f9fd4c
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:698:17
  11:     0x5636d46b5777 - std::panicking::begin_panic_handler::{{closure}}::he054b2a83a51d2cd
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:588:13
  12:     0x5636d46b3d44 - std::sys_common::backtrace::__rust_end_short_backtrace::ha48b94ab49b30915
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:138:18
  13:     0x5636d46b54a9 - rust_begin_unwind
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
  14:     0x5636d4340f33 - core::panicking::panic_fmt::h366d3a309ae17c94
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
  15:     0x5636d44658e2 - cbindgen::bindgen::ir::generic_path::GenericParams::call::h608a2c26fabb28f8
  16:     0x5636d43f8c7b - <cbindgen::bindgen::ir::typedef::Typedef as cbindgen::bindgen::ir::item::Item>::instantiate_monomorph::h9179017e3d30578d
  17:     0x5636d4406d0f - cbindgen::bindgen::ir::ty::Type::add_monomorphs::hf6f1324df96e24dd
  18:     0x5636d44c1909 - cbindgen::bindgen::library::Library::generate::h6408eddedae8fb83
  19:     0x5636d4484551 - cbindgen::bindgen::builder::Builder::generate::hf5912236b0a05f2d
  20:     0x5636d43e03a4 - cbindgen::main::hb9272d25604fa6c0
  21:     0x5636d43c4213 - std::sys_common::backtrace::__rust_begin_short_backtrace::h1dd300b3a2c8f3e3
  22:     0x5636d43e8719 - std::rt::lang_start::{{closure}}::hbcd9dd36169e673d
  23:     0x5636d46ab12e - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::had4f69b3aefb47a8
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/ops/function.rs:259:13
  24:     0x5636d46ab12e - std::panicking::try::do_call::hf2ad5355fcafe775
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:492:40
  25:     0x5636d46ab12e - std::panicking::try::h0a63ac363423e61e
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:456:19
  26:     0x5636d46ab12e - std::panic::catch_unwind::h18088edcecb8693a
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panic.rs:137:14
  27:     0x5636d46ab12e - std::rt::lang_start_internal::{{closure}}::ha7dad166dc711761
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/rt.rs:128:48
  28:     0x5636d46ab12e - std::panicking::try::do_call::hda0c61bf3a57d6e6
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:492:40
  29:     0x5636d46ab12e - std::panicking::try::hbc940e68560040a9
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:456:19
  30:     0x5636d46ab12e - std::panic::catch_unwind::haed0df2aeb3fa368
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panic.rs:137:14
  31:     0x5636d46ab12e - std::rt::lang_start_internal::h9c06694362b5b80c
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/rt.rs:128:20
  32:     0x5636d43e1142 - main
  33:     0x7ff806868290 - <unknown>
  34:     0x7ff80686834a - __libc_start_main
  35:     0x5636d43411d5 - _start
                               at /build/glibc/src/glibc/csu/../sysdeps/x86_64/start.S:115
  36:                0x0 - <unknown>

Github is to stupid to make spoilers, so it's a huge message...

emilio commented 2 years ago

A reduced test-case or link to that repository would be useful to be able to investigate this.

emilio commented 5 months ago

Please reopen if this still happens and you provide a way to repro this :)