On 2021-09-18 07:22, Brian Inglis wrote:
On 2021-09-17 14:25, Bruno Haible wrote:
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 ;;

Patch would not apply as included gnulib and bison threadlib.m4 appear to be from July and August.
Respun and applied patch successfully to glm4/threadlib.m4.
Still did not change gnulib or bison builds to configure weak=no or check successfully.
Were there additional conditions required to ensure that was used?

Had to configure with explicit gl_cv_have_weak=no arg to successfully configure and run tests.

Please see attached tars for logs and config.*.

Patch also made no difference to bison build, but adding to CYGCONF_ARGS explicit gl_cv_have_weak=no allowed all tests to run:

* D, Java, 129: Output file name: `~!..., 150: Tabulations and multibyte characters, 283-287: syncline escapes, 647: LAC: Exploratory stack, were skipped;

* all but two others 672-673: Doxygen Public-Private Documentation were successful.

Please see attached bison...check.log.gz.

So the diagnosis and cure were correct and worked, but the patch did not seem to make any difference?

[Dropping bug-bison]

Attaching the patches provided by Bruno (gnulib/...orig.patch), respun for gnulib config tests (gnulib/...patch), and respun for bison config tests (threadlib...patch).

--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]
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/glm4/threadlib.m4 2021-08-02 23:51:08 -0600
+++ b/glm4/threadlib.m4 2021-09-17 14:52:21 -0600
@@ -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 ;;
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/glm4/threadlib.m4 2021-07-17 10:19:19.000000000 -0600
+++ b/glm4/threadlib.m4 2021-09-17 21:06:03.205361000 -0600
@@ -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,38 +84,48 @@ 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
-     dnl First, test whether the compiler accepts it syntactically.
-     AC_LINK_IFELSE(
-       [AC_LANG_PROGRAM(
-          [[extern void xyzzy ();
+    [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(
+             [[extern void xyzzy ();
 #pragma weak xyzzy]],
-          [[xyzzy();]])],
-       [gl_cv_have_weak=maybe])
-     if test $gl_cv_have_weak = maybe; then
-       dnl Second, test whether it actually works. On Cygwin 1.7.2, with
-       dnl gcc 4.3, symbols declared weak always evaluate to the address 0.
-       AC_RUN_IFELSE(
-         [AC_LANG_SOURCE([[
+             [[xyzzy();]])],
+          [gl_cv_have_weak=maybe])
+        if test $gl_cv_have_weak = maybe; then
+          dnl Second, test whether it actually works. On Cygwin 1.7.2, with
+          dnl gcc 4.3, symbols declared weak always evaluate to the address 0.
+          AC_RUN_IFELSE(
+            [AC_LANG_SOURCE([[
 #include <stdio.h>
 #pragma weak fputs
 int main ()
 {
   return (fputs == NULL);
 }]])],
-         [gl_cv_have_weak=yes],
-         [gl_cv_have_weak=no],
-         [dnl When cross-compiling, assume that only ELF platforms support
-          dnl weak symbols.
-          AC_EGREP_CPP([Extensible Linking Format],
-            [#ifdef __ELF__
-             Extensible Linking Format
-             #endif
-            ],
-            [gl_cv_have_weak="guessing yes"],
-            [gl_cv_have_weak="guessing no"])
-         ])
-     fi
+            [gl_cv_have_weak=yes],
+            [gl_cv_have_weak=no],
+            [dnl When cross-compiling, assume that only ELF platforms support
+             dnl weak symbols.
+             AC_EGREP_CPP([Extensible Linking Format],
+               [#ifdef __ELF__
+                Extensible Linking Format
+                #endif
+               ],
+               [gl_cv_have_weak="guessing yes"],
+               [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 ;;
--- origsrc/bison-3.8.1/m4/threadlib.m4 2021-08-02 23:51:08.000000000 -0600
+++ src/bison-3.8.1/m4/threadlib.m4     2021-09-17 15:17:37.103525500 -0600
@@ -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,38 +84,48 @@ 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
-     dnl First, test whether the compiler accepts it syntactically.
-     AC_LINK_IFELSE(
-       [AC_LANG_PROGRAM(
-          [[extern void xyzzy ();
+    [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(
+             [[extern void xyzzy ();
 #pragma weak xyzzy]],
-          [[xyzzy();]])],
-       [gl_cv_have_weak=maybe])
-     if test $gl_cv_have_weak = maybe; then
-       dnl Second, test whether it actually works. On Cygwin 1.7.2, with
-       dnl gcc 4.3, symbols declared weak always evaluate to the address 0.
-       AC_RUN_IFELSE(
-         [AC_LANG_SOURCE([[
+             [[xyzzy();]])],
+          [gl_cv_have_weak=maybe])
+        if test $gl_cv_have_weak = maybe; then
+          dnl Second, test whether it actually works. On Cygwin 1.7.2, with
+          dnl gcc 4.3, symbols declared weak always evaluate to the address 0.
+          AC_RUN_IFELSE(
+            [AC_LANG_SOURCE([[
 #include <stdio.h>
 #pragma weak fputs
 int main ()
 {
   return (fputs == NULL);
 }]])],
-         [gl_cv_have_weak=yes],
-         [gl_cv_have_weak=no],
-         [dnl When cross-compiling, assume that only ELF platforms support
-          dnl weak symbols.
-          AC_EGREP_CPP([Extensible Linking Format],
-            [#ifdef __ELF__
-             Extensible Linking Format
-             #endif
-            ],
-            [gl_cv_have_weak="guessing yes"],
-            [gl_cv_have_weak="guessing no"])
-         ])
-     fi
+            [gl_cv_have_weak=yes],
+            [gl_cv_have_weak=no],
+            [dnl When cross-compiling, assume that only ELF platforms support
+             dnl weak symbols.
+             AC_EGREP_CPP([Extensible Linking Format],
+               [#ifdef __ELF__
+                Extensible Linking Format
+                #endif
+               ],
+               [gl_cv_have_weak="guessing yes"],
+               [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 ;;

Reply via email to