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 <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2022-02-26 17:58:28 +01:00
parent 82a7a87b3b
commit 8216257015
2 changed files with 2 additions and 2 deletions

View File

@ -92,7 +92,7 @@ case "${host_os}" in
mingw*) mingw*)
AM_CONDITIONAL([T_WIN], true) AM_CONDITIONAL([T_WIN], true)
AM_CONDITIONAL([ADD_RT], false) AM_CONDITIONAL([ADD_RT], false)
AC_SUBST([AM_LDFLAGS], ['-Wl,-no-undefined -Wl,--as-needed']) AC_SUBST([AM_LDFLAGS], ['-no-undefined'])
;; ;;
cygwin*) cygwin*)
AM_CONDITIONAL([ADD_RT], false) AM_CONDITIONAL([ADD_RT], false)

View File

@ -103,7 +103,7 @@ tesseract_LDADD += $(libcurl_LIBS)
if T_WIN if T_WIN
tesseract_LDADD += -ltiff tesseract_LDADD += -ltiff
tesseract_LDADD += -lws2_32 tesseract_LDADD += -lws2_32
libtesseract_la_LDFLAGS += -no-undefined -Wl,--as-needed -lws2_32 libtesseract_la_LDFLAGS += -no-undefined -lws2_32
endif endif
if ADD_RT if ADD_RT
tesseract_LDADD += -lrt tesseract_LDADD += -lrt