Open TheComputerGuy96 opened 3 weeks ago
As a bit of a workaround, I found setting the env var BINDGEN_EXTRA_CLANG_ARGS
to either --target=i686-unknown-linux-gnu
or -target i686-unknown-linux-gnu
got things compiling correctly. You'll need to set it during the build process (when you call meson compile -C build
).
Describe the bug So the rustc
--target
argument (which is usually included in therust
value of cross files) isn't passed to the bindgen command lineThis isn't a problem in non-cross builds, but with cross builds the struct size validation fails with variable-length types like pointers (which was an optional thing but now it's enabled by default with https://github.com/rust-lang/rust-bindgen/commit/4f78afa67a574383123fe306b0927eb17bd40bf6)
This issue was also reported on https://gitlab.freedesktop.org/mesa/mesa/-/issues/11735
To reproduce https://gist.github.com/TheComputerGuy96/8069e05f5db26a304bc11026ca07c290
To compile those files on Arch Linux:
meson setup --cross-file lib32 build && meson compile -C build
(you possibly need to make a cross file in other distros)Expected behavior The rustc target argument should be passed to bindgen (with the correct struct sizes for 32-bit cross build)
System parameters