rust-bindgen icon indicating copy to clipboard operation
rust-bindgen copied to clipboard

Cannot serialize type kind Opaque with valists and wrap-static-fns

Open NickeZ opened this issue 6 months ago • 1 comments

Test fails for aarch64-unknown-linux-gnu.

How to reproduce:

$ cargo run -- --wrap-static-fns bindgen-tests/tests/headers/wrap-static-fns.h -- -target aarch64-unknown-linux-gnu
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.08s
     Running `target/debug/bindgen --wrap-static-fns bindgen-tests/tests/headers/wrap-static-fns.h -- -target aarch64-unknown-linux-gnu`
Unable to generate bindings: codegen error: serialization error at bindgen-tests/tests/headers/wrap-static-fns.h:63:56: Cannot serialize type kind Opaque

Was found when trying to enable that target in CI: https://github.com/rust-lang/rust-bindgen/pull/3217

There are some more hints in the discussions in that PR.

NickeZ avatar Jun 18 '25 12:06 NickeZ

(Edit: Had some erroneous findings here previously, replaced with something more useful below.)

I tried minimizing the header file by hand, and the following contents seem to be enough to cause the error:

static void fn1(__builtin_va_list va);
Result --wrap-static-fns -- -target aarch64-unknown-linux-gnu
error x x
yes x -
empty - x
yes - -

miikkas avatar Jul 22 '25 15:07 miikkas