From 82162570150eccefb9112992449f27dd91913957 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sat, 26 Feb 2022 17:58:28 +0100 Subject: [PATCH] Fix linker flags for MSYS2 clang64 builds MSYS2 clang64 uses the lld linker which does not support --as-needed. The normal GNU ld uses that linker option with ELF targets but ignores it for PE targets (.exe, .dll), so it can be removed. Remove also the -Wl, which is only needed when linker options are passed to the compiler but not when they are directly passed to the linker. Signed-off-by: Stefan Weil --- configure.ac | 2 +- src/api/Makefile.am | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 4637efc9..d8fc4f2a 100644 --- a/configure.ac +++ b/configure.ac @@ -92,7 +92,7 @@ case "${host_os}" in mingw*) AM_CONDITIONAL([T_WIN], true) AM_CONDITIONAL([ADD_RT], false) - AC_SUBST([AM_LDFLAGS], ['-Wl,-no-undefined -Wl,--as-needed']) + AC_SUBST([AM_LDFLAGS], ['-no-undefined']) ;; cygwin*) AM_CONDITIONAL([ADD_RT], false) diff --git a/src/api/Makefile.am b/src/api/Makefile.am index 22747623..f0fe46db 100644 --- a/src/api/Makefile.am +++ b/src/api/Makefile.am @@ -103,7 +103,7 @@ tesseract_LDADD += $(libcurl_LIBS) if T_WIN tesseract_LDADD += -ltiff tesseract_LDADD += -lws2_32 -libtesseract_la_LDFLAGS += -no-undefined -Wl,--as-needed -lws2_32 +libtesseract_la_LDFLAGS += -no-undefined -lws2_32 endif if ADD_RT tesseract_LDADD += -lrt