[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-readline] readline-5.2 does not link necessary libraries, breaking
From: |
Adam J. Richter |
Subject: |
[Bug-readline] readline-5.2 does not link necessary libraries, breaking parted |
Date: |
Wed, 21 Mar 2007 12:28:49 -0400 |
When readline-5.2 builds its sharead library, it does not
"-lcurses" to the ld command. Consequently, the resultant .so file
does not indicate the it needs libcurses.so. So, attempts to link to
link agaisnt readline using "ld --if-needed" will fail. For example,
the configure script for GNU parted-1.8.6 attempts to link a test
program on my system thusly:
cc -o conftest conftest.c -Wl,--if-needed -lreadline -lncurses [...]
"--if-needed" does not consider symbols that were undefined in
other shared libraries (such as readline requiring symbols from
ncurses). So, the link fails. Without "--if-needed", the link succeeds.
I'm not quite sure why "--if-needed" is defined to behave this
way, but the documentation for ld also appears to be pretty clear
about this, so it not a binutils implementation mistake. A design
botch in binutils it might be.
Anyhow, assuming this behavior of "--if-needed" is "correct",
then I think "correct" fix would to be to pass the necessary shared
libraries in the link command for the readline shared library.
There is already some commented out code in
readline-5.2/configure.in that appears to be intended to fix this
problem. Uncommenting that code fixes the problem, although I am not
sure why that code attempts to restrict the shared libraries being
passed to the readline link command to curses, ncurses and termcap. I
would think that such filtering is unecessary. Anyhow, I've attached
the patch that uncomments the code I'm referring to, just to be clear,
although I'm not sure that this is the perfect patch. I'd be
interested in knowing why the code was commented out.
Adam Richter
---
src/configure.in | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/configure.in b/src/configure.in
index 868773b..9d1f3fb 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -211,10 +211,10 @@ if test -f ${srcdir}/support/shobj-conf; then
AC_MSG_CHECKING(configuration for building shared libraries)
eval `TERMCAP_LIB=$TERMCAP_LIB ${CONFIG_SHELL-/bin/sh}
${srcdir}/support/shobj-conf -C "${CC}" -c ${host_cpu} -o ${host_os} -v
${host_vendor}`
-# case "$SHLIB_LIBS" in
-# *curses*|*termcap*|*termlib*) ;;
-# *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;;
-# esac
+ case "$SHLIB_LIBS" in
+ *curses*|*termcap*|*termlib*) ;;
+ *) SHLIB_LIBS="$SHLIB_LIBS $TERMCAP_LIB" ;;
+ esac
AC_SUBST(SHOBJ_CC)
AC_SUBST(SHOBJ_CFLAGS)
- [Bug-readline] readline-5.2 does not link necessary libraries, breaking parted,
Adam J. Richter <=