From 9c1604ef7abbbdf4a2312f18c0e60370961a14b2 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 21 Sep 2018 10:20:05 -0700 Subject: [PATCH] Attempt to fix libgit2's MinGW build --- libgit2-sys/build.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libgit2-sys/build.rs b/libgit2-sys/build.rs index 12ad5c383a..1d23f483ab 100644 --- a/libgit2-sys/build.rs +++ b/libgit2-sys/build.rs @@ -58,6 +58,13 @@ fn main() { if windows { add_c_files(&mut cfg, "libgit2/src/win32".as_ref()); cfg.define("STRSAFE_NO_DEPRECATE", None); + + // libgit2's build system claims that forks like mingw-w64 of MinGW + // still want this define to use C99 stdio functions automatically. + // Apparently libgit2 breaks at runtime if this isn't here? Who knows! + if target.contains("gnu") { + cfg.define("__USE_MINGW_ANSI_STDIO", "1"); + } } else { add_c_files(&mut cfg, "libgit2/src/unix".as_ref()); cfg.flag("-fvisibility=hidden");