Brian Inglis wrote: > > Can you also try to build it through > > > > gl_cv_have_weak=no ../configure -C && make && make check > > > > in a different subdirectory? > > > > Please send the config.log, config.cache, config.status, and > > gltests/test-suite.log for each run. > > Done and attached
Thanks! Indeed, gl_cv_have_weak=no appears to make the essential difference. Therefore, I'm applying this fix. 2021-09-17 Bruno Haible <br...@clisp.org> threadlib: Avoid crashes in thread-related functions on Cygwin 3.2.0. Reported by Brian Inglis via Akim Demaille in <https://lists.gnu.org/archive/html/bug-gnulib/2021-09/msg00063.html>. * m4/threadlib.m4 (gl_WEAK_SYMBOLS): Force a "guessing no" result on Cygwin. diff -w --git a/m4/threadlib.m4 b/m4/threadlib.m4 index 37b797c18..6b43bbdfa 100644 --- a/m4/threadlib.m4 +++ b/m4/threadlib.m4 @@ -1,4 +1,4 @@ -# threadlib.m4 serial 31 +# threadlib.m4 serial 32 dnl Copyright (C) 2005-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -84,7 +84,15 @@ AC_DEFUN([gl_WEAK_SYMBOLS], AC_REQUIRE([AC_CANONICAL_HOST]) AC_CACHE_CHECK([whether imported symbols can be declared weak], [gl_cv_have_weak], - [gl_cv_have_weak=no + [case "$host_os" in + cygwin*) + dnl On Cygwin 3.2.0 with gcc 10.2, the test below would succeed, but + dnl programs that use pthread_in_use() with weak symbol references + dnl crash miserably at runtime. + gl_cv_have_weak="guessing no" + ;; + *) + gl_cv_have_weak=no dnl First, test whether the compiler accepts it syntactically. AC_LINK_IFELSE( [AC_LANG_PROGRAM( @@ -116,6 +124,8 @@ int main () [gl_cv_have_weak="guessing no"]) ]) fi + ;; + esac dnl But when linking statically, weak symbols don't work. case " $LDFLAGS " in *" -static "*) gl_cv_have_weak=no ;;