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

aarch64 size_t mismatch

Open ibigbug opened this issue 2 years ago • 6 comments

Input C/C++ Header

https://github.com/cloudflare/boring/blob/2ab71411c19ef6136174152c605cf3511fbbb336/boring-sys/build/main.rs#L688-L718

Bindgen Invocation

https://github.com/cloudflare/boring/blob/2ab71411c19ef6136174152c605cf3511fbbb336/boring-sys/build/main.rs#L648-L671

and

cargo build --target aarch64-unknown-linux-gnu

Actual Results

  thread 'main' panicked at 'assertion failed: `(left == right)`
    left: `4`,
   right: `8`: Target platform requires `--no-size_t-is-usize`. The size of `ssize_t` (4) does not match the target pointer size (8)', /home/wtf/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.68.1/codegen/mod.rs:908:25

Expected Results

Hi,

I'm trying to build for 64 bit arm but it complains the size t is 32 bit and mismatch.

what could be missed?

ty

ibigbug avatar Nov 21 '23 17:11 ibigbug

I encountered the same problem, do you have any solution?

uupks avatar Jan 04 '24 06:01 uupks

Can anyone post a minimal reproduction? PRs to fix this are welcome

tgross35 avatar Jan 13 '24 03:01 tgross35

Minimal reproduction step includes, cross compiling for arm64 (aarch64) target on x86 machine. Also, 'build-dependency' set to 'bindgen' crate.

vithalsm avatar Feb 16 '24 16:02 vithalsm

A minimal reproduction would be the smallest type that reproduces the error and could become a unit test, unfortunately not an entire codebase. A snip of the failing test and its related types in both C and Rust would also be useful.

tgross35 avatar Feb 21 '24 20:02 tgross35

This issue seems pretty similar to the one I opened: https://github.com/rust-lang/rust-bindgen/issues/2776.

MasterAwesome avatar Mar 07 '24 02:03 MasterAwesome

In my case, problem was fixed by using proper 'target' header file. While cross compiling, cdefs.h from host was being referred instead of using one from 'target' toolchain. By adjusting the include file path from 'target' via 'sysroot' settings, its working fine.

vithalsm avatar Mar 07 '24 09:03 vithalsm