From 663f1a707d25c490f66c2208c889fa887420e083 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Mon, 12 Dec 2022 19:27:20 +0100 Subject: [PATCH] Link gcc helpers statically on MinGW (#488) When compiling a 32bit dll with the mingw-w64 compiler, some 64bit integer arithmetic operations are implemented using functions from libgcc (e.g. __udivdi3 and __umoddi3 from libgcc_s_dw2-1.dll). This unexpected dependency is inconvenient for applications. The run-time dependency can be avoid by linking statically. --- configure.ac | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac index 5d05e45bc..cc7ceaca0 100644 --- a/configure.ac +++ b/configure.ac @@ -123,6 +123,7 @@ case $host in os="windows" threads="windows" win_implementation="mingw" + LDFLAGS="${LDFLAGS} -static-libgcc" ;; *-msys*) AC_MSG_RESULT([ (Windows back-end, using MSYS2)]) @@ -130,6 +131,7 @@ case $host in os="windows" threads="windows" win_implementation="mingw" + LDFLAGS="${LDFLAGS} -static-libgcc" ;; *-cygwin*) AC_MSG_RESULT([ (Windows back-end, using Cygwin)])