-
-
Notifications
You must be signed in to change notification settings - Fork 250
Description
Building for Windows target (x86_64-pc-windows-msvc
) using cargo-xwin
fails with compile-time overflow errors in generated gdextension_interface.rs
due to POSIX-specific pthread types. The project builds successfully on macOS for native target.
- Host OS: macOS (Darwin 25.0.0)
- Target:
x86_64-pc-windows-msvc
(cross-compilation) - Rust Version: 1.90.0 (1159e78c4 2025-09-14)
- Cargo Version: 1.90.0 (840b83a10 2025-07-30)
- cargo-xwin Version: 0.19.2
- gdext Commit: 4a58210 (master branch)
- gdextension-api Version: 0.3.0 (from
godot4-prebuilt
, branchrelease-v0.3
)
Build command is cargo-xwin build --target x86_64-pc-windows-msvc
, and below is the error log
Compiling godot-ffi v0.4.0 (/Users/allen/Documents/RustProjects/gdext/godot-ffi)
error[E0080]: attempt to compute `60_usize - 64_usize`, which would overflow
--> /Users/allen/Documents/RustProjects/gdext/target/x86_64-pc-windows-msvc/debug/build/godot-ffi-e7d67e72d2f75b7b/out/gdextension_interface.rs:164:40
|
164 | ["Size of _opaque_pthread_attr_t"][::std::mem::size_of::<_opaque_pthread_attr_t>() - 64usize];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `gen::gdextension_interface::_` failed here
error[E0080]: attempt to compute `44_usize - 48_usize`, which would overflow
--> /Users/allen/Documents/RustProjects/gdext/target/x86_64-pc-windows-msvc/debug/build/godot-ffi-e7d67e72d2f75b7b/out/gdextension_interface.rs:180:40
|
180 | ["Size of _opaque_pthread_cond_t"][::std::mem::size_of::<_opaque_pthread_cond_t>() - 48usize];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `gen::gdextension_interface::_` failed here
error[E0080]: attempt to compute `12_usize - 16_usize`, which would overflow
--> /Users/allen/Documents/RustProjects/gdext/target/x86_64-pc-windows-msvc/debug/build/godot-ffi-e7d67e72d2f75b7b/out/gdextension_interface.rs:197:10
|
197 | [::std::mem::size_of::<_opaque_pthread_condattr_t>() - 16usize];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `gen::gdextension_interface::_` failed here
error[E0080]: attempt to compute `60_usize - 64_usize`, which would overflow
--> /Users/allen/Documents/RustProjects/gdext/target/x86_64-pc-windows-msvc/debug/build/godot-ffi-e7d67e72d2f75b7b/out/gdextension_interface.rs:213:41
|
213 | ["Size of _opaque_pthread_mutex_t"][::std::mem::size_of::<_opaque_pthread_mutex_t>() - 64usize];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `gen::gdextension_interface::_` failed here
error[E0080]: attempt to compute `12_usize - 16_usize`, which would overflow
--> /Users/allen/Documents/RustProjects/gdext/target/x86_64-pc-windows-msvc/debug/build/godot-ffi-e7d67e72d2f75b7b/out/gdextension_interface.rs:230:10
|
230 | [::std::mem::size_of::<_opaque_pthread_mutexattr_t>() - 16usize];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `gen::gdextension_interface::_` failed here
error[E0080]: attempt to compute `12_usize - 16_usize`, which would overflow
--> /Users/allen/Documents/RustProjects/gdext/target/x86_64-pc-windows-msvc/debug/build/godot-ffi-e7d67e72d2f75b7b/out/gdextension_interface.rs:246:40
|
246 | ["Size of _opaque_pthread_once_t"][::std::mem::size_of::<_opaque_pthread_once_t>() - 16usize];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `gen::gdextension_interface::_` failed here
error[E0080]: attempt to compute `196_usize - 200_usize`, which would overflow
--> /Users/allen/Documents/RustProjects/gdext/target/x86_64-pc-windows-msvc/debug/build/godot-ffi-e7d67e72d2f75b7b/out/gdextension_interface.rs:263:10
|
263 | [::std::mem::size_of::<_opaque_pthread_rwlock_t>() - 200usize];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `gen::gdextension_interface::_` failed here
error[E0080]: attempt to compute `20_usize - 24_usize`, which would overflow
--> /Users/allen/Documents/RustProjects/gdext/target/x86_64-pc-windows-msvc/debug/build/godot-ffi-e7d67e72d2f75b7b/out/gdextension_interface.rs:280:10
|
280 | [::std::mem::size_of::<_opaque_pthread_rwlockattr_t>() - 24usize];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `gen::gdextension_interface::_` failed here
error: could not compile `godot-ffi` (lib) due to 8 previous errors
Seems the issue was introduced in commit e86f723 ("Enable support for Godot 4.5") from September 27, 2025, which updated the gdextension-api
dependency.
-
The
godot-ffi/build.rs
generates Rust bindings from the prebuilt C header file provided bygdextension-api
-
The prebuilt header (v0.3.0) contains POSIX-specific pthread type definitions:
_opaque_pthread_attr_t
_opaque_pthread_cond_t
_opaque_pthread_condattr_t
_opaque_pthread_mutex_t
_opaque_pthread_mutexattr_t
_opaque_pthread_once_t
_opaque_pthread_rwlock_t
_opaque_pthread_rwlockattr_t
-
When bindgen processes these types for the Windows target, it generates struct definitions with different sizes than expected (smaller than the hardcoded size assertions)
-
The generated code contains compile-time assertions that fail during compilation for Windows targets