bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] m4/pthread-cond.m4: fix build without threads


From: Fabrice Fontaine
Subject: [PATCH] m4/pthread-cond.m4: fix build without threads
Date: Sun, 4 Apr 2021 21:04:07 +0200

HAVE_PTHREAD_COND_xxx variables are wrongly set to 1 instead of 0 if
HAVE_PTHREAD_H is set to 0 since
https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=e08989ca11a13c8a09cb0c34f797af5a40753379

This will result in the following build failure if threads are not
available, for example with coreutils in version 8.32:

/home/buildroot/autobuild/run/instance-2/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabihf/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabihf/bin/ld:
 src/libsinglebin_sort.a(libsinglebin_sort_a-sort.o): in function 
`queue_insert':
sort.c:(.text+0x1d5c): undefined reference to `pthread_cond_signal'
/home/buildroot/autobuild/run/instance-2/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabihf/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabihf/bin/ld:
 src/libsinglebin_sort.a(libsinglebin_sort_a-sort.o): in function `sortlines':
sort.c:(.text+0x2868): undefined reference to `pthread_cond_wait'
/home/buildroot/autobuild/run/instance-2/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabihf/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabihf/bin/ld:
 src/libsinglebin_sort.a(libsinglebin_sort_a-sort.o): in function 
`single_binary_main_sort':
sort.c:(.text+0x5a24): undefined reference to `pthread_cond_init

Fixes:
 - 
http://autobuild.buildroot.org/results/acb58a76642c6ffd8f0b752349a6e754fc011e86

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 m4/pthread-cond.m4 | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/m4/pthread-cond.m4 b/m4/pthread-cond.m4
index 75e37c613..f6ff6c0e6 100644
--- a/m4/pthread-cond.m4
+++ b/m4/pthread-cond.m4
@@ -23,14 +23,14 @@ AC_DEFUN([gl_PTHREAD_COND],
     REPLACE_PTHREAD_COND_DESTROY=1
   else
     if test $HAVE_PTHREAD_H = 0; then
-      HAVE_PTHREAD_COND_INIT=1
-      HAVE_PTHREAD_CONDATTR_INIT=1
-      HAVE_PTHREAD_CONDATTR_DESTROY=1
-      HAVE_PTHREAD_COND_WAIT=1
-      HAVE_PTHREAD_COND_TIMEDWAIT=1
-      HAVE_PTHREAD_COND_SIGNAL=1
-      HAVE_PTHREAD_COND_BROADCAST=1
-      HAVE_PTHREAD_COND_DESTROY=1
+      HAVE_PTHREAD_COND_INIT=0
+      HAVE_PTHREAD_CONDATTR_INIT=0
+      HAVE_PTHREAD_CONDATTR_DESTROY=0
+      HAVE_PTHREAD_COND_WAIT=0
+      HAVE_PTHREAD_COND_TIMEDWAIT=0
+      HAVE_PTHREAD_COND_SIGNAL=0
+      HAVE_PTHREAD_COND_BROADCAST=0
+      HAVE_PTHREAD_COND_DESTROY=0
     fi
   fi
 ])
-- 
2.30.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]