google / autocxx

Tool for safe ergonomic Rust/C++ interop driven from existing C++ headers
https://docs.rs/autocxx
Apache License 2.0
2.25k stars 144 forks source link

Build Failure Debug Techniques #1378

Open johnoneil opened 4 months ago

johnoneil commented 4 months ago

Describe the bug

I'm really looking for some suggestion in how to debug autocxx Builder errors.

When I generate Rust bindings on a very large C++ codebase as follows:

    let mut autocxx_build =
        autocxx_build::Builder::new("src/xxx.rs", include_paths.as_slice())
            .extra_clang_args(clang_args.as_slice())
            .build()
            .unwrap();

I get a pretty obscure fatal error.

called `Result::unwrap()` on an `Err` value: ParseError(AutocxxCodegenError(Conversion(Cpp(UnsupportedType("[u64 ; 4usize]")))))

The project we're generating bindings to is large with many hundreds of headers and the codebase changes often. I'm unsure what header changed to cause this error.

What is your best suggestion to find the header which this error originates from? Is there a more verbose setting for the builder for it to dump what .h files it's currently scanning? Any other options?

I'm currently just hand editing a local copy of autocxx to see if I can shoehorn in some more info to help trace the offending .h file.

To Reproduce See above.

Expected behavior Just looking for debugging advice.

Additional context N/A

adetaylor commented 1 month ago

You can see lots of debug information by following these instructions; good luck!