From 83cacbec8450fd2105e735727d236b077e1fbb4a Mon Sep 17 00:00:00 2001 From: Fabrice Desclaux Date: Thu, 12 Nov 2026 14:16:42 +0100 Subject: [PATCH] bindgen: blocklist AMX tile types on MinGW Fixes #138 On x86_64-pc-windows-gnu, hwcontext_wrapper.h includes mingw-w64's WIDL-generated d3d11.h, which pulls in windows.h -> x86intrin.h before its include guard, and thus clang's amxintrin.h. Its __tile1024i_str struct has a 64-byte-aligned member that bindgen emits as both packed and aligned, so the generated bindings fail to compile (E0587/E0080). FFmpeg never uses AMX types and the AMX intrinsics are already hidden by blocklist_function("_.*"), so blocklisting the types is a no-op on targets that don't see them (MSVC, i686, non-x86). Patch assisted by Claude --- build.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.rs b/build.rs index c08fd29..9e74fec 100644 --- a/build.rs +++ b/build.rs @@ -1733,6 +1733,11 @@ fn main() { .blocklist_function("y1l") .blocklist_function("ynl") .opaque_type("__mingw_ldbl_type_t") + // MinGW: hwcontext_wrapper.h -> d3d11.h -> windows.h -> x86intrin.h pulls in + // clang's AMX intrinsics. `__tile1024i_str` has a 64-byte-aligned member that + // bindgen emits as both packed and aligned (E0587). FFmpeg never uses AMX. + // https://github.com/zmwangx/rust-ffmpeg-sys/issues/138 + .blocklist_type("_{1,2}tile1024i.*") .default_enum_style(bindgen::EnumVariation::Rust { non_exhaustive: env::var("CARGO_FEATURE_NON_EXHAUSTIVE_ENUMS").is_ok(), })