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

thread 'main' panicked at .... is not a valid Ident #2700

Closed
aholtzma-am opened this issue Dec 21, 2023 · 5 comments
Closed

thread 'main' panicked at .... is not a valid Ident #2700

aholtzma-am opened this issue Dec 21, 2023 · 5 comments

Comments

@aholtzma-am
Copy link

The problem occurs on an otherwise working codebase when built on Sonoma 14.0. Looking at the very few times I can find this message coming up, it was related to the wrong libclang being used, but I don't have another other copies or clang or llvm.

How should I go about debugging this?

Input C/C++ Header

Failure is somewhere in MacOS system headers on Sonoma 14.0.

Bindgen Invocation

  let bindings = bindgen::Builder::default()
        // The input header we would like to generate
        // bindings for.
        .header("wrapper.h")
        .clang_arg("-I/opt/homebrew/include")
        .clang_arg("-L/opt/homebrew/lib")
        // Don't convert size_t to an int of the pointer size
        .size_t_is_usize(true)
        // Finish the builder and generate the bindings.
        .generate()
        // Unwrap the Result and panic on failure.
        .expect("Unable to generate bindings");

Actual Results

thread 'main' panicked at '"wait_struct_(unnamed_at_/Applications/Xcode_app/Contents/Developer/Platforms/MacOSX_platform/Developer/SDKs/MacOSX_sdk/usr/include/sys/wait_h_199_2)" is not a valid Ident', /Users/aholtzma/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.56.0/src/ir/context.rs:846:9
stack backtrace:
0: rust_begin_unwind
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/std/src/panicking.rs:593:5
1: core::panicking::panic_fmt
at /rustc/5680fa18feaa87f3ff04063800aec256c3d4b4be/library/core/src/panicking.rs:67:14
2: proc_macro2::fallback::validate_ident
3: proc_macro2::fallback::Ident::new_checked
4: proc_macro2::imp::Ident::new_checked
5: proc_macro2::Ident::new
6: bindgen::ir::context::BindgenContext::rust_ident_raw
7: bindgen::ir::context::BindgenContext::rust_ident
8: <bindgen::ir::comp::CompInfo as bindgen::codegen::CodeGenerator>::codegen
9: <bindgen::ir::ty::Type as bindgen::codegen::CodeGenerator>::codegen
10: <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen
11: <bindgen::ir::comp::CompInfo as bindgen::codegen::CodeGenerator>::codegen
12: <bindgen::ir::ty::Type as bindgen::codegen::CodeGenerator>::codegen
13: <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen
14: <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::{{closure}}
15: <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen
16: <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen
17: bindgen::codegen::codegen::{{closure}}
18: bindgen::ir::context::BindgenContext::gen
19: bindgen::codegen::codegen
20: bindgen::Bindings::generate
21: bindgen::Builder::generate
22: build_script_build::main
23: core::ops::function::FnOnce::call_once
note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.

Expected Results

The build to be successful.

@emilio
Copy link
Contributor

emilio commented Dec 21, 2023

You need to update bindgen. You're using 0.56.0 which doesn't contain the relevant fix iirc.

@aholtzma-am
Copy link
Author

Am on 0.56.0.

[[package]]
name = "bindgen"
version = "0.56.0"

@aholtzma-am
Copy link
Author

What can I do to debug this? It panics before the bindings are output. Is there a debug mode I can turn on?

@emilio
Copy link
Contributor

emilio commented Dec 22, 2023

You need a newer version of bindgen. We fixed this a while ago. #2319 landed in 0.65.1 and such.

@emilio emilio closed this as completed Dec 22, 2023
@aholtzma-am
Copy link
Author

Sorry misread your comment that you needed to be running 0.56.0 with the fix. Thanks.

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