From 68aebc4419999caf9fc2df79ca07fbb52e9a18b7 Mon Sep 17 00:00:00 2001 From: waych Date: Fri, 2 Apr 2021 02:56:27 -0700 Subject: [PATCH] sdl2-sys: Skip defining _fltused (#1082) Upstream SDL2 will include _fltused in the libary artifact as a __declspec(selectany) symbol. This seems to cause problems however with a definition already coming from the top-most rust link, as it already gets defined elsewhere when building statically. Rather than patching the upstream codebase with another patch, just specify this flag in all cases as we don't require it in any of our rust builds. --- sdl2-sys/build.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sdl2-sys/build.rs b/sdl2-sys/build.rs index 4cfda7a6..d46564a1 100644 --- a/sdl2-sys/build.rs +++ b/sdl2-sys/build.rs @@ -305,6 +305,12 @@ fn patch_sdl2(sdl2_source_path: &Path) { fn compile_sdl2(sdl2_build_path: &Path, target_os: &str) -> PathBuf { let mut cfg = cmake::Config::new(sdl2_build_path); + // Override __FLTUSED__ to keep the _fltused symbol from getting defined in the static build. + // This conflicts and fails to link properly when building statically on Windows, likely due to + // COMDAT conflicts/breakage happening somewhere. + #[cfg(feature = "static-link")] + cfg.cflag("-D__FLTUSED__"); + #[cfg(target_os = "linux")] { use version_compare::Version;