In order to build for gnu target you need to switch default-host to gnu target if you have msvc target as default.
My understanding the build.rs is build with default-host so if you build with cargo build --target=x86_64-pc-windows-gnu and have selected default-host x86_64-pc-windows-msvc it fails to link.
I think the checks for target must be runtime instead of compile time in order this to work.
(I just don't really know if there is another way to get cargo build --target to build build.rs with that selected target)
In order to build for gnu target you need to switch default-host to gnu target if you have msvc target as default. My understanding the build.rs is build with default-host so if you build with
cargo build --target=x86_64-pc-windows-gnu
and have selected default-hostx86_64-pc-windows-msvc
it fails to link.I think the checks for target must be runtime instead of compile time in order this to work. (I just don't really know if there is another way to get
cargo build --target
to buildbuild.rs
with that selected target)