[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
grep-3.5 fails to build on Solaris when libsigsegv is installed
From: |
Bruno Haible |
Subject: |
grep-3.5 fails to build on Solaris when libsigsegv is installed |
Date: |
Tue, 29 Sep 2020 04:02:32 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-189-generic; KDE/5.18.0; x86_64; ; ) |
Hi Paul,
On Solaris 10, when libsigsegv is installed with the same --prefix as
passed to grep's configure:
- grep 3.4 builds fine.
- grep 3.5 fails to build:
CCLD grep
ld: warning: file /PREFIX/lib/libiconv.so: attempted multiple inclusion of file
Undefined first referenced
symbol in file
stackoverflow_install_handler ../lib/libgreputils.a(c-stack.o)
sigsegv_install_handler ../lib/libgreputils.a(c-stack.o)
ld: fatal: symbol referencing errors. No output written to grep
*** Error code 1
Also, a build error is seen in the gnulib-tests directory:
$ gmake check
...
CCLD test-c-stack
Undefined first referenced
symbol in file
stackoverflow_install_handler ../lib/libgreputils.a(c-stack.o)
sigsegv_install_handler ../lib/libgreputils.a(c-stack.o)
ld: fatal: symbol referencing errors. No output written to test-c-stack
gmake[3]: *** [Makefile:3301: test-c-stack] Error 1
In both versions, config.status contains
S["LIBSIGSEGV"]="/PREFIX/lib/libsigsegv.a -lc"
The difference is that in grep-3.4
S["LIBCSTACK"]="/PREFIX/lib/libsigsegv.a -lc"
whereas in grep-3.5
S["LIBCSTACK"]=""
I can reproduce the problem with a testdir of module 'c-stack'.
This patch fixes it. BUT... see below.
2020-09-28 Bruno Haible <bruno@clisp.org>
c-stack: Fix link error when libsigsegv is used (regression 2020-09-20).
* m4/c-stack.m4 (gl_PREREQ_C_STACK): Link with libsigsegv when
libsigsegv is installed and stack overflow heuristics work.
diff --git a/m4/c-stack.m4 b/m4/c-stack.m4
index e98f80f..b86fc8f 100644
--- a/m4/c-stack.m4
+++ b/m4/c-stack.m4
@@ -7,7 +7,7 @@
# Written by Paul Eggert.
-# serial 18
+# serial 19
AC_DEFUN([AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC],
[
@@ -360,9 +360,10 @@ AC_DEFUN([gl_PREREQ_C_STACK],
AC_CHECK_TYPES([stack_t], , , [#include <signal.h>])
- dnl c-stack does not need -lsigsegv if the system has XSI heuristics.
+ dnl c-stack.c uses libsigsegv when HAVE_XSI_STACK_OVERFLOW_HEURISTIC and
+ dnl HAVE_LIBSIGSEGV are both 1.
if test "$gl_cv_lib_sigsegv" = yes \
- && test "$gl_cv_sys_xsi_stack_overflow_heuristic" != yes; then
+ && test "$gl_cv_sys_xsi_stack_overflow_heuristic" = yes; then
AC_SUBST([LIBCSTACK], [$LIBSIGSEGV])
AC_SUBST([LTLIBCSTACK], [$LTLIBSIGSEGV])
fi
BUT I don't want to push it since there seems to be also a mistake in
c-stack.c. Before the 2020-09-20 patch, the idea of c-stack.c was:
- If HAVE_XSI_STACK_OVERFLOW_HEURISTIC is defined, use that heuristic.
- Otherwise, if libsigsegv is present, use it to catch stack overflows.
(It contains 3 different heuristics.)
- Otherwise, punt.
There was a comment:
/* Only use libsigsegv if we need it; platforms like Solaris can
detect stack overflow without the overhead of an external
library. */
#if HAVE_LIBSIGSEGV && ! HAVE_XSI_STACK_OVERFLOW_HEURISTIC
In the new code, there is a comment:
/* Use libsigsegv only if needed; kernels like Solaris can detect
stack overflow without the overhead of an external library. */
#define USE_LIBSIGSEGV (HAVE_XSI_STACK_OVERFLOW_HEURISTIC && HAVE_LIBSIGSEGV)
There seems to be a logic mistake, here.
Bruno
- grep-3.5 fails to build on Solaris when libsigsegv is installed,
Bruno Haible <=