Skip to content

build fails with (signal: 11, SIGSEGV: invalid memory reference) #493

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

Closed
dignifiedquire opened this issue Feb 7, 2017 · 22 comments
Closed

Comments

@dignifiedquire
Copy link

dignifiedquire commented Feb 7, 2017

I'v been trying to generate headers for this project: https://github.com/chadnickbok/librtcdcpp but after multiple attempts been stopped by this error:

> RUST_LOG=libbindgen RUST_BACKTRACE=1 cargo test 
   Compiling librtcd v0.1.0 (file:///Users/dignifiedquire/opensource/webrtc/librtcd.rs)
     Running `/Users/dignifiedquire/opensource/webrtc/librtcd.rs/target/debug/build/librtcd-ae95765e3b1668b3/build-script-build`
error: failed to run custom build command for `librtcd v0.1.0 (file:///Users/dignifiedquire/opensource/webrtc/librtcd.rs)`
process didn't exit successfully: `/Users/dignifiedquire/opensource/webrtc/librtcd.rs/target/debug/build/librtcd-ae95765e3b1668b3/build-script-build` (signal: 11, SIGSEGV: invalid memory reference)
--- stdout
cargo:rustc-link-search=native=/Users/dignifiedquire/opensource/webrtc/librtcd.rs/lib

You can find the code I am using in https://github.com/dignifiedquire/librtcd.rs

Any idea what could be causing this? (Sorry if I am missing something obvious my C++ knowledge is pretty limited)

@jeandudey
Copy link

Are you on 32 bits? if the answer is yes please see this

@dignifiedquire
Copy link
Author

no, I am on 64bit macOS

@emilio
Copy link
Contributor

emilio commented Feb 8, 2017

Which version of bindgen is this using? Does it reproduce with latest master? We worked around a libclang crash related to unspecialized c++ templates that showed up in OSX's stdlib recently (see #462 and #466).

@emilio
Copy link
Contributor

emilio commented Feb 8, 2017

Sounds likely this is the same, because I haven't been able to repro on linux. If it isn't I'd need you to get a backtrace or something to try to figure out what is this :)

@dignifiedquire
Copy link
Author

Trying some things out right now. The original error seems to be related to me not using the correct clang version. But even after the switch things are not doing what they are supposed to do.

@dignifiedquire
Copy link
Author

Running on rust stable (1.14) with bindgen@0.21.2:

> RUST_BACKTRACE=1 cargo +stable test
   Compiling librtcd v0.1.0 (file:///Users/dignifiedquire/opensource/webrtc/librtcd.rs)
error: failed to run custom build command for `librtcd v0.1.0 (file:///Users/dignifiedquire/opensource/webrtc/librtcd.rs)`
process didn't exit successfully: `/Users/dignifiedquire/opensource/webrtc/librtcd.rs/target/debug/build/librtcd-a86e564b677ee655/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-search=native=/Users/dignifiedquire/opensource/webrtc/librtcd.rs/lib

--- stderr
thread 'main' panicked at 'attempt to calculate the remainder with a divisor of zero', /Users/dignifiedquire/opensource/webrtc/librtcd.rs/target/debug/build/bindgen-f94df381e218b7c6/out/codegen.rs:897
stack backtrace:
   1:        0x10f29043a - std::sys::imp::backtrace::tracing::imp::write::h917062bce4ff48c3
   2:        0x10f294d5f - std::panicking::default_hook::{{closure}}::h0bacac31b5ed1870
   3:        0x10f293abf - std::panicking::default_hook::h5897799da33ece67
   4:        0x10f294096 - std::panicking::rust_panic_with_hook::h109e116a3a861224
   5:        0x10f293f34 - std::panicking::begin_panic::hbb38be1379e09df0
   6:        0x10f293e52 - std::panicking::begin_panic_fmt::h26713cea9bce3ab0
   7:        0x10f293db7 - rust_begin_unwind
   8:        0x10f2c1000 - core::panicking::panic_fmt::hcfbb59eeb7f27f75
   9:        0x10f2c0f04 - core::panicking::panic::hd383cb12a44b01ff
  10:        0x10ebee127 - bindgen::codegen::struct_layout::StructLayoutTracker::padding_bytes::he28313190c49efe3
  11:        0x10ebed7c3 - bindgen::codegen::struct_layout::StructLayoutTracker::saw_union::h9468e2efcbae3a10
  12:        0x10ec089e4 - <bindgen::ir::comp::CompInfo as bindgen::codegen::CodeGenerator>::codegen::ha0e3833b766c53e4
  13:        0x10ebf36f0 - <bindgen::ir::ty::Type as bindgen::codegen::CodeGenerator>::codegen::h5b5c387580413712
  14:        0x10ebf0eeb - <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen::h7fe79dd4e50ab7f7
  15:        0x10ec0a02a - <bindgen::ir::comp::CompInfo as bindgen::codegen::CodeGenerator>::codegen::ha0e3833b766c53e4
  16:        0x10ebf36f0 - <bindgen::ir::ty::Type as bindgen::codegen::CodeGenerator>::codegen::h5b5c387580413712
  17:        0x10ebf0eeb - <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen::h7fe79dd4e50ab7f7
  18:        0x10ec4f20a - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::{{closure}}::hf33e5bff3980e70c
  19:        0x10ebf1229 - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::h026b57b4c3c0a981
  20:        0x10ebf0daf - <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen::h7fe79dd4e50ab7f7
  21:        0x10ec4f20a - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::{{closure}}::hf33e5bff3980e70c
  22:        0x10ec4f092 - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::{{closure}}::heae6ea807a29ce00
  23:        0x10ebefc7d - bindgen::codegen::CodegenResult::inner::h9c14a7627cdfad82
  24:        0x10ebf127b - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::h026b57b4c3c0a981
  25:        0x10ebf0daf - <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen::h7fe79dd4e50ab7f7
  26:        0x10ec4f20a - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::{{closure}}::hf33e5bff3980e70c
  27:        0x10ec4f092 - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::{{closure}}::heae6ea807a29ce00
  28:        0x10ebefc7d - bindgen::codegen::CodegenResult::inner::h9c14a7627cdfad82
  29:        0x10ebf127b - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::h026b57b4c3c0a981
  30:        0x10ebf0daf - <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen::h7fe79dd4e50ab7f7
  31:        0x10ec4ec5d - bindgen::codegen::codegen::{{closure}}::h46354299059cf516
  32:        0x10ebc40fc - bindgen::ir::context::BindgenContext::gen::h1998e61a06902e49
  33:        0x10ec20acb - bindgen::codegen::codegen::ha32ed6404bc3fcda
  34:        0x10ebe4fef - bindgen::Bindings::generate::h6438f2d07094a7f2
  35:        0x10ebe3ce5 - bindgen::Builder::generate::ha6d1dc5e9dc3e6fd
  36:        0x10ea45a36 - build_script_build::main::hf206fe450e67054a
  37:        0x10f29531a - __rust_maybe_catch_panic
  38:        0x10f294436 - std::rt::lang_start::hd661476ce2fc2931
  39:        0x10ea45c79 - main

Running on rust stable (1.14) with bindgen@master:

> RUST_BACKTRACE=1 cargo +stable test
   Compiling librtcd v0.1.0 (file:///Users/dignifiedquire/opensource/webrtc/librtcd.rs)
error: failed to run custom build command for `librtcd v0.1.0 (file:///Users/dignifiedquire/opensource/webrtc/librtcd.rs)`
process didn't exit successfully: `/Users/dignifiedquire/opensource/webrtc/librtcd.rs/target/debug/build/librtcd-a86e564b677ee655/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-search=native=/Users/dignifiedquire/opensource/webrtc/librtcd.rs/lib

--- stderr
thread 'main' panicked at 'attempt to calculate the remainder with a divisor of zero', /Users/dignifiedquire/opensource/webrtc/librtcd.rs/target/debug/build/bindgen-f94df381e218b7c6/out/codegen.rs:897
stack backtrace:
   1:        0x105bf043a - std::sys::imp::backtrace::tracing::imp::write::h917062bce4ff48c3
   2:        0x105bf4d5f - std::panicking::default_hook::{{closure}}::h0bacac31b5ed1870
   3:        0x105bf3abf - std::panicking::default_hook::h5897799da33ece67
   4:        0x105bf4096 - std::panicking::rust_panic_with_hook::h109e116a3a861224
   5:        0x105bf3f34 - std::panicking::begin_panic::hbb38be1379e09df0
   6:        0x105bf3e52 - std::panicking::begin_panic_fmt::h26713cea9bce3ab0
   7:        0x105bf3db7 - rust_begin_unwind
   8:        0x105c21000 - core::panicking::panic_fmt::hcfbb59eeb7f27f75
   9:        0x105c20f04 - core::panicking::panic::hd383cb12a44b01ff
  10:        0x10554e127 - bindgen::codegen::struct_layout::StructLayoutTracker::padding_bytes::he28313190c49efe3
  11:        0x10554d7c3 - bindgen::codegen::struct_layout::StructLayoutTracker::saw_union::h9468e2efcbae3a10
  12:        0x1055689e4 - <bindgen::ir::comp::CompInfo as bindgen::codegen::CodeGenerator>::codegen::ha0e3833b766c53e4
  13:        0x1055536f0 - <bindgen::ir::ty::Type as bindgen::codegen::CodeGenerator>::codegen::h5b5c387580413712
  14:        0x105550eeb - <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen::h7fe79dd4e50ab7f7
  15:        0x10556a02a - <bindgen::ir::comp::CompInfo as bindgen::codegen::CodeGenerator>::codegen::ha0e3833b766c53e4
  16:        0x1055536f0 - <bindgen::ir::ty::Type as bindgen::codegen::CodeGenerator>::codegen::h5b5c387580413712
  17:        0x105550eeb - <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen::h7fe79dd4e50ab7f7
  18:        0x1055af20a - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::{{closure}}::hf33e5bff3980e70c
  19:        0x105551229 - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::h026b57b4c3c0a981
  20:        0x105550daf - <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen::h7fe79dd4e50ab7f7
  21:        0x1055af20a - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::{{closure}}::hf33e5bff3980e70c
  22:        0x1055af092 - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::{{closure}}::heae6ea807a29ce00
  23:        0x10554fc7d - bindgen::codegen::CodegenResult::inner::h9c14a7627cdfad82
  24:        0x10555127b - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::h026b57b4c3c0a981
  25:        0x105550daf - <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen::h7fe79dd4e50ab7f7
  26:        0x1055af20a - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::{{closure}}::hf33e5bff3980e70c
  27:        0x1055af092 - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::{{closure}}::heae6ea807a29ce00
  28:        0x10554fc7d - bindgen::codegen::CodegenResult::inner::h9c14a7627cdfad82
  29:        0x10555127b - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::h026b57b4c3c0a981
  30:        0x105550daf - <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen::h7fe79dd4e50ab7f7
  31:        0x1055aec5d - bindgen::codegen::codegen::{{closure}}::h46354299059cf516
  32:        0x1055240fc - bindgen::ir::context::BindgenContext::gen::h1998e61a06902e49
  33:        0x105580acb - bindgen::codegen::codegen::ha32ed6404bc3fcda
  34:        0x105544fef - bindgen::Bindings::generate::h6438f2d07094a7f2
  35:        0x105543ce5 - bindgen::Builder::generate::ha6d1dc5e9dc3e6fd
  36:        0x1053a5a36 - build_script_build::main::hf206fe450e67054a
  37:        0x105bf531a - __rust_maybe_catch_panic
  38:        0x105bf4436 - std::rt::lang_start::hd661476ce2fc2931
  39:        0x1053a5c79 - main

@emilio
Copy link
Contributor

emilio commented Feb 8, 2017

Well, this is due to recent changes to support padding in struct layout, cc @flier.

can you attach the log resulting from running with RUST_LOG=bindgen? that will help to get a relatively reduced testcase.

@dignifiedquire
Copy link
Author

I'm not sure what I'm doing wrong, but there doesn't seem to be any additional output when running with rust_log

> RUST_BACKTRACE=1 RUST_LOG=bindgen cargo +stable test
   Compiling librtcd v0.1.0 (file:///Users/dignifiedquire/opensource/webrtc/librtcd.rs)
error: failed to run custom build command for `librtcd v0.1.0 (file:///Users/dignifiedquire/opensource/webrtc/librtcd.rs)`
process didn't exit successfully: `/Users/dignifiedquire/opensource/webrtc/librtcd.rs/target/debug/build/librtcd-7e187874fd9e785f/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-link-search=native=/Users/dignifiedquire/opensource/webrtc/librtcd.rs/lib

--- stderr
thread 'main' panicked at 'attempt to calculate the remainder with a divisor of zero', /Users/dignifiedquire/opensource/webrtc/librtcd.rs/target/debug/build/bindgen-b8176bee56170882/out/codegen.rs:897
stack backtrace:
   1:        0x105d9e32a - std::sys::imp::backtrace::tracing::imp::write::hd3b65cdfe843284c
   2:        0x105da18bf - std::panicking::default_hook::{{closure}}::hf2b7428652613d83
   3:        0x105da1567 - std::panicking::default_hook::h5da8f27db5582938
   4:        0x105da1d26 - std::panicking::rust_panic_with_hook::hcef1e67c646c6802
   5:        0x105da1bc4 - std::panicking::begin_panic::hc2e8ca89533cd10d
   6:        0x105da1ae2 - std::panicking::begin_panic_fmt::h60990696c3c3a88d
   7:        0x105da1a47 - rust_begin_unwind
   8:        0x105dca1f0 - core::panicking::panic_fmt::h10231c789bd0e97d
   9:        0x105dca0f4 - core::panicking::panic::h5e44af975c0a7e4d
  10:        0x105701e27 - bindgen::codegen::struct_layout::StructLayoutTracker::padding_bytes::ha49c4e29038a2852
  11:        0x1057009c3 - bindgen::codegen::struct_layout::StructLayoutTracker::saw_union::h64ba87d26b56117a
  12:        0x10571cd50 - <bindgen::ir::comp::CompInfo as bindgen::codegen::CodeGenerator>::codegen::h263ddf5ab0eaf7a9
  13:        0x1057078b0 - <bindgen::ir::ty::Type as bindgen::codegen::CodeGenerator>::codegen::h169fef65711902d7
  14:        0x105704c8a - <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen::h2704ad81fda103e5
  15:        0x10571e394 - <bindgen::ir::comp::CompInfo as bindgen::codegen::CodeGenerator>::codegen::h263ddf5ab0eaf7a9
  16:        0x1057078b0 - <bindgen::ir::ty::Type as bindgen::codegen::CodeGenerator>::codegen::h169fef65711902d7
  17:        0x105704c8a - <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen::h2704ad81fda103e5
  18:        0x1057054de - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::{{closure}}::hbc43e26b5773c70c
  19:        0x105704fc9 - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::h8fab0b2c35160b48
  20:        0x105704b4f - <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen::h2704ad81fda103e5
  21:        0x1057054de - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::{{closure}}::hbc43e26b5773c70c
  22:        0x105705782 - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::{{closure}}::ha17314384f42790b
  23:        0x105703a2d - bindgen::codegen::CodegenResult::inner::hac3e1bc6cecafa08
  24:        0x10570501b - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::h8fab0b2c35160b48
  25:        0x105704b4f - <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen::h2704ad81fda103e5
  26:        0x1057054de - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::{{closure}}::hbc43e26b5773c70c
  27:        0x105705782 - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::{{closure}}::ha17314384f42790b
  28:        0x105703a2d - bindgen::codegen::CodegenResult::inner::hac3e1bc6cecafa08
  29:        0x10570501b - <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::h8fab0b2c35160b48
  30:        0x105704b4f - <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen::h2704ad81fda103e5
  31:        0x105737d1d - bindgen::codegen::codegen::{{closure}}::h677644e149cfb83c
  32:        0x1056d279c - bindgen::ir::context::BindgenContext::gen::h0958288b705e3c3d
  33:        0x1057377bb - bindgen::codegen::codegen::he381bbc640a74281
  34:        0x1056f7c71 - bindgen::Bindings::generate::h38266cd02e0522f6
  35:        0x1056f6995 - bindgen::Builder::generate::h81920dbf0c2b0622
  36:        0x105552456 - build_script_build::main::h029a1f78fe6e13fd
  37:        0x105da2b9a - __rust_maybe_catch_panic
  38:        0x105da20c6 - std::rt::lang_start::h87cb84a8b6cb187e
  39:        0x105552689 - main

@emilio
Copy link
Contributor

emilio commented Feb 8, 2017

Huh, I guess you need to run the script itself (RUST_LOG=bindgen /Users/dignifiedquire/opensource/webrtc/librtcd.rs/target/debug/build/librtcd-7e187874fd9e785f/build-script-build)? I'd expect that to work.

@dignifiedquire
Copy link
Author

This doesn't look particularly useful either

RUST_LOG=bindgen RUST_BACKTRACE=1 target/debug/build/librtcd-7e187874fd9e785f/build-script-build
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: NotPresent', /Users/rustbuild/src/rust-buildbot/slave/stable-dist-rustc-mac/build/src/libcore/result.rs:837
stack backtrace:
   1:        0x10a3a132a - std::sys::imp::backtrace::tracing::imp::write::hd3b65cdfe843284c
   2:        0x10a3a48bf - std::panicking::default_hook::{{closure}}::hf2b7428652613d83
   3:        0x10a3a4567 - std::panicking::default_hook::h5da8f27db5582938
   4:        0x10a3a4d26 - std::panicking::rust_panic_with_hook::hcef1e67c646c6802
   5:        0x10a3a4bc4 - std::panicking::begin_panic::hc2e8ca89533cd10d
   6:        0x10a3a4ae2 - std::panicking::begin_panic_fmt::h60990696c3c3a88d
   7:        0x10a3a4a47 - rust_begin_unwind
   8:        0x10a3cd1f0 - core::panicking::panic_fmt::h10231c789bd0e97d
   9:        0x109b431bc - core::result::unwrap_failed::h87e02be15280848b
  10:        0x109b3e9f4 - <core::result::Result<T, E>>::unwrap::hdaaf57062bd9932c
  11:        0x109b5519d - build_script_build::main::h029a1f78fe6e13fd
  12:        0x10a3a5b9a - __rust_maybe_catch_panic
  13:        0x10a3a50c6 - std::rt::lang_start::h87cb84a8b6cb187e
  14:        0x109b55689 - main

@emilio
Copy link
Contributor

emilio commented Feb 8, 2017

Gah, likely to need whatever env vars your build script uses, maybe OUT_DIR.

I can't take a look right now, will do when I have the time.

@dignifiedquire
Copy link
Author

dignifiedquire commented Feb 8, 2017

When passing all the env variables, it runs but still no log output:

> CARGO=MANIFEST_DIR=/Users/dignifiedquire/opensource/webrtc/librtcd.rs/ OUT_DIR=/Users/dignifiedquire/opensource/webrtc/librtcd.rs/target/debug/build/bindgen-b8176bee56170882/out RUST_LOG=bindgen target/debug/build/librtcd-7e187874fd9e785f/build-script-build
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: NotPresent', /Users/rustbuild/src/rust-buildbot/slave/stable-dist-rustc-mac/build/src/libcore/result.rs:837
note: Run with `RUST_BACKTRACE=1` for a backtrace.

will see if I can find the reason why RUST_LOG doesn't like me

@emilio
Copy link
Contributor

emilio commented Feb 8, 2017

That's still panicking when not finding an env var though.

@dignifiedquire
Copy link
Author

dignifiedquire commented Feb 8, 2017

Wrong copy, paste

> CARGO_MANIFEST_DIR=/Users/dignifiedquire/opensource/webrtc/librtcd.rs/ OUT_DIR=/Users/dignifiedquire/opensource/webrtc/librtcd.rs/target/debug/build/bindgen-b8176bee56170882/out RUST_LOG=bindgen target/debug/build/librtcd-7e187874fd9e785f/build-script-build
cargo:rustc-link-search=native=/Users/dignifiedquire/opensource/webrtc/librtcd.rs/lib
thread 'main' panicked at 'attempt to calculate the remainder with a divisor of zero', /Users/dignifiedquire/opensource/webrtc/librtcd.rs/target/debug/build/bindgen-b8176bee56170882/out/codegen.rs:897
note: Run with `RUST_BACKTRACE=1` for a backtrace.

@flier
Copy link
Contributor

flier commented Feb 8, 2017

For the struct_layout::StructLayoutTracker::padding_bytes crash, seem caused by an empty layout without align value

    fn padding_bytes(&self, layout: Layout) -> usize {
        if self.latest_offset % layout.align == 0 {
            0
        } else {
            layout.align - (self.latest_offset % layout.align)
        }
    }

I will submit a patch to avoid it soon.

On the other hand, when I try to reproduce it, I got a lot of error like

--- stderr
ERROR:bindgen::ir::item: Unhandled cursor kind CXCursorKind(30): Cursor(__test kind: FunctionTemplate, loc: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:451:28, usr: Some("c:@N@std@N@__1@N@__libcpp_is_function_imp@FT@>1#T__test#*t0.0#C#"))
ERROR:bindgen::ir::item: Unhandled cursor kind CXCursorKind(30): Cursor(__test kind: FunctionTemplate, loc: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:452:27, usr: Some("c:@N@std@N@__1@N@__libcpp_is_function_imp@FT@>1#T__test#$@N@std@N@__1@N@__libcpp_is_function_imp@S@__dummy_type#C#"))
ERROR:bindgen::ir::item: Unhandled cursor kind CXCursorKind(30): Cursor(__test kind: FunctionTemplate, loc: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:453:28, usr: Some("c:@N@std@N@__1@N@__libcpp_is_function_imp@FT@>1#T__test.#$@N@std@N@__1@S@__two#"))

I'm not sure whether it is cause the wrong layout

@dignifiedquire
Copy link
Author

@flier I can reproduce this, but only when using bindgen@0.21.2 with rust-nightly

log: https://gist.github.com/dignifiedquire/cb97915e83c52361c7b5de6e9e7cc5d7

@emilio
Copy link
Contributor

emilio commented Feb 8, 2017

The solution here is just avoiding the division by zero, should be a one line patch.

bors-servo pushed a commit that referenced this issue Feb 8, 2017
check empty layout when padding bytes

fast workaround to fix issue #493

need to investigate why layout is empty
@flier
Copy link
Contributor

flier commented Feb 8, 2017

@flier I can reproduce this, but only when using bindgen@0.21.2 with rust-nightly

log: https://gist.github.com/dignifiedquire/cb97915e83c52361c7b5de6e9e7cc5d7

@dignifiedquire which rust-nightly version you are using?

$ rustup run nightly rustc --version
rustc 1.17.0-nightly (c49d10207 2017-02-07)

@dignifiedquire
Copy link
Author

dignifiedquire commented Feb 8, 2017

> rustup run nightly rustc --version

rustc 1.17.0-nightly (c49d10207 2017-02-07)

@dignifiedquire
Copy link
Author

@flier you pr doesn't appear fix it #494 (comment)

@flier
Copy link
Contributor

flier commented Feb 8, 2017

@emilio seems an invalid enum decl cause the empty layout.

WARN:bindgen::codegen: Guessing type of enum! Forward declarations of enums shouldn't be legal!
WARN:bindgen::codegen: invalid enum decl: signed: true, size: 0

DEBUG:bindgen::codegen::struct_layout: align field __bindgen_anon_1 to 0/0 with 0 padding bytes Layout { size: 0, align: 0, packed: false }, calculated Layout { size: 0, align: 0, packed: false }

bors-servo pushed a commit that referenced this issue Feb 8, 2017
check layout align before padding bytes

Fix issue #493 again :S

Still finding way to reproduce it
@emilio
Copy link
Contributor

emilio commented Feb 15, 2017

This should be fixed now.

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

4 participants