You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let bindings = bindgen::Builder::default().header("test_struct.h").clang_args(&["-x","c++"]).whitelist_type("JStructString").enable_cxx_namespaces().parse_callbacks(Box::new(bindgen::CargoCallbacks))// Finish the builder and generate the bindings..generate()// Unwrap the Result and panic on failure..expect("Unable to generate bindings");
Actual Results
test root::__bindgen_test_layout_basic_string_open0_char_char_traits_open1_char_close1_allocator_open1_char_close1_close0_instantiation ... FAILED
test root::bindgen_test_layout_JStructString ... FAILED
failures:
---- root::__bindgen_test_layout_basic_string_open0_char_char_traits_open1_char_close1_allocator_open1_char_close1_close0_instantiation stdout ----
thread 'root::__bindgen_test_layout_basic_string_open0_char_char_traits_open1_char_close1_allocator_open1_char_close1_close0_instantiation' panicked at 'assertion failed: `(left == right)`
left: `16`,
right: `32`: Size of template specialization: root :: std :: basic_string < :: std :: os :: raw :: c_char >', /data1/Programming/bindgen_test/target/debug/build/bindgen_test-50b60b0d3abdf93c/out/bindings.rs:451:9
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/libunwind.rs:88
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:47
3: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:36
4: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:200
5: std::panicking::default_hook
at src/libstd/panicking.rs:211
6: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:477
7: std::panicking::continue_panic_fmt
at src/libstd/panicking.rs:384
8: std::panicking::begin_panic_fmt
at src/libstd/panicking.rs:339
9: bindgen_test::root::__bindgen_test_layout_basic_string_open0_char_char_traits_open1_char_close1_allocator_open1_char_close1_close0_instantiation
at ./target/debug/build/bindgen_test-50b60b0d3abdf93c/out/bindings.rs:451
10: bindgen_test::root::__bindgen_test_layout_basic_string_open0_char_char_traits_open1_char_close1_allocator_open1_char_close1_close0_instantiation::{{closure}}
at ./target/debug/build/bindgen_test-50b60b0d3abdf93c/out/bindings.rs:449
11: core::ops::function::FnOnce::call_once
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libcore/ops/function.rs:235
12: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/liballoc/boxed.rs:787
13: __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:80
14: std::panicking::try
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/panicking.rs:275
15: std::panic::catch_unwind
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/panic.rs:394
16: test::run_test::run_test_inner::{{closure}}
at src/libtest/lib.rs:1408
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- root::bindgen_test_layout_JStructString stdout ----
thread 'root::bindgen_test_layout_JStructString' panicked at 'assertion failed: `(left == right)`
left: `16`,
right: `32`: Size of: JStructString', /data1/Programming/bindgen_test/target/debug/build/bindgen_test-50b60b0d3abdf93c/out/bindings.rs:427:9
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/libunwind.rs:88
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:47
3: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:36
4: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:200
5: std::panicking::default_hook
at src/libstd/panicking.rs:211
6: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:477
7: std::panicking::continue_panic_fmt
at src/libstd/panicking.rs:384
8: std::panicking::begin_panic_fmt
at src/libstd/panicking.rs:339
9: bindgen_test::root::bindgen_test_layout_JStructString
at ./target/debug/build/bindgen_test-50b60b0d3abdf93c/out/bindings.rs:427
10: bindgen_test::root::bindgen_test_layout_JStructString::{{closure}}
at ./target/debug/build/bindgen_test-50b60b0d3abdf93c/out/bindings.rs:426
11: core::ops::function::FnOnce::call_once
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libcore/ops/function.rs:235
12: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/liballoc/boxed.rs:787
13: __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:80
14: std::panicking::try
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/panicking.rs:275
15: std::panic::catch_unwind
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/panic.rs:394
16: test::run_test::run_test_inner::{{closure}}
at src/libtest/lib.rs:1408
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
The text was updated successfully, but these errors were encountered:
Yeah, there are known issues with the STL (which is very unfortunate, I know). Generally it's recommended to mark the stl as blacklisted or opaque, so that the types have the right layout :/
Uh oh!
There was an error while loading. Please reload this page.
Hi, when trying to create bindings to a struct that contains a C++ std::string, the tests on those particular structs fail with an incorrect size.
I'm using bindgen version 0.54.0 and using clang version 10.0.0 provided via linuxbrew.
Is this something that:
I would note the library I am wanting to use bindgen on isn't able to be changed.
Thanks
Input C/C++ Header
Bindgen Invocation
Actual Results
The text was updated successfully, but these errors were encountered: