* [PATCH] m4/pthread-cond.m4: fix build without threads
@ 2021-04-04 19:04 Fabrice Fontaine
2021-04-04 23:15 ` Bruno Haible
0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Fontaine @ 2021-04-04 19:04 UTC (permalink / raw)
To: bug-gnulib; +Cc: Fabrice Fontaine
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] m4/pthread-cond.m4: fix build without threads
2021-04-04 19:04 [PATCH] m4/pthread-cond.m4: fix build without threads Fabrice Fontaine
@ 2021-04-04 23:15 ` Bruno Haible
0 siblings, 0 replies; 2+ messages in thread
From: Bruno Haible @ 2021-04-04 23:15 UTC (permalink / raw)
To: bug-gnulib; +Cc: Fabrice Fontaine
Hi,
Fabrice Fontaine wrote:
> 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
Indeed, that's obviously a copy&paste mistake.
> This will result in the following build failure if threads are not
> available, for example with coreutils in version 8.32:
Thanks for the analysis and fix. Applied with a ChangeLog entry:
2021-04-04 Fabrice Fontaine <fontaine.fabrice@gmail.com>
pthread-cond: Fix wrong configure results when <pthread.h> is absent.
* m4/pthread-cond.m4 (gl_PTHREAD_COND): When <pthread.h> does not exist,
set HAVE_PTHREAD_COND_* to 0, not to 1.
diff --git a/m4/pthread-cond.m4 b/m4/pthread-cond.m4
index 75e37c6..8922a8a 100644
--- a/m4/pthread-cond.m4
+++ b/m4/pthread-cond.m4
@@ -1,4 +1,4 @@
-# pthread-cond.m4 serial 1
+# pthread-cond.m4 serial 2
dnl Copyright (C) 2019-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,
@@ -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
])
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-04 23:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-04 19:04 [PATCH] m4/pthread-cond.m4: fix build without threads Fabrice Fontaine
2021-04-04 23:15 ` Bruno Haible
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).