[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bison-1.30h: SGI IRIX 6.5 and -lintl
From: |
Akim Demaille |
Subject: |
Re: bison-1.30h: SGI IRIX 6.5 and -lintl |
Date: |
22 Dec 2001 16:44:49 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Civil Service) |
Thanks for detailed analysis Nelson!
Given that the problem is unrelated to Bison, but might influence a
lot of other projects, I'd like to have the opinion of other
maintainers. Jim, Paul, how do you handle that yourselves?
------------------------------------------------------------
The build of bison-1.30h on SGI IRIX 6.5 exposed a problem with the
library -lintl that pops up increasingly frequently: namely, this
system (and several other commercial UNIXes) by default does not
record the location of a shared library in a linked executable.
This means that the program cannot then run subsequently unless
LD_LIBRARY_PATH has been set appropriately.
Bison uses -lintl, which is a GNU library not normally provided by
commercial UNIX vendors. Thus, on my systems, it is installed in
/usr/local/lib, not /usr/lib or /lib.
GNU/Linux systems offer the /etc/ld.so.conf file which contains a list
of directories that the run-time loader should automatically search
for shared libraries, and on all of our such systems, we have added
/usr/local/lib, and a few others, to that file, then run /etc/ldconfig
to update the cache of library names.
However, on other UNIX systems, one is faced with either requiring
users to set LD_LIBRARY_PATH (intolerable at our site, with more than
10K accounts), or with redoing builds with additional flags that force
the linker to record library locations inside the executable.
On SGI IRIX 6.5, after the "make check" failed because of the missing
library, I removed src/bison, and remade it with
make CC="gcc -Wl,-rpath /usr/local/lib"
The "make check" tests then all passed.
Unfortunately, the flags needed to achieve this recording vary between
compilers and platforms.
In some of my own recent code, which uses the GNU readline library
that is similarly installed in /usr/local/lib, I handled this problem
by this configure.in fragment, which you are most welcome to adapt for
bison. [Some may suggest using GNU libtool to handle this problem,
but I'm not in favor of that approach: I've seen too many builds fail
on my 15+ flavors of UNIX because of libtool problems.] Improvements
to this fragment from bison developers are invited, so that I can
improve my own code.
if test -n "$libreadline"
then
dnl Checks for two flavors of curses libraries needed when
dnl -lreadline is used
AC_LANG_PUSH(C)
dnl OLD: AC_CHECK_LIB(ncurses, tgoto, libcurses=-lncurses, libcurses=)
dnl OLD: test -z "$libcurses" && (AC_CHECK_LIB(curses, tgoto,
libcurses=-lcurses, libcurses=))
dnl LIBS="$LIBS $libcurses"
AC_SEARCH_LIBS(tgoto, [ncurses curses])
AC_LANG_POP(C)
dnl Because AC_SEARCH_LIBS prepends libraries to LIBS, we need to put
dnl any -lreadline in FRONT of the curses library
LIBS="$libreadline $LIBS"
AC_MSG_CHECKING(if extra LDFLAGS are needed to record the location of
shared libraries)
dnl We cannot use AC_TRY_RUN() here, because it gives no
dnl opportunity to provide a test input file, sigh...
cat >conftest.c <<"EOF"
#include "confdefs.h"
#include <stdio.h>
#include <readline/readline.h>
int main()
{
(void)readline((char *)NULL);
return (0);
}
EOF
dnl Sadly, UNIX implementations are incompatibly divided on
dnl how to inform the linker to record load library locations,
dnl so that LD_LIBRARY_PATH is not needed at run time. The
dnl LDFLAGS settings change from O/S to OS, and compiler to
dnl compiler, and even the same compiler on different O/Ses
dnl may have different conventions. What a mess!
dnl NB: "" is specified both at the start and the end: if none
dnl of them work, we fall back to ""
for extraldflags in \
"" \
"-R$locallib" \
"-Wl,-rpath $locallib" \
"-rpath $locallib" \
""
do
$RM -f ./a.out 2>/dev/null
$CC $CFLAGS conftest.c -o a.out $LDFLAGS $extraldflags $LIBS
>&5 2>/dev/null && \
LD_LIBRARY_PATH= ./a.out < /dev/null >&5 2>/dev/null &&
\
break
done
$RM -f ./a.out 2>/dev/null
if test -z "$extraldflags"
then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
LDFLAGS="$LDFLAGS $extraldflags"
fi
fi
-------------------------------------------------------------------------------
- Nelson H. F. Beebe Tel: +1 801 581 5254 -
- Center for Scientific Computing FAX: +1 801 585 1640, +1 801 581 4148 -
- University of Utah Internet e-mail: address@hidden -
- Department of Mathematics, 322 INSCC address@hidden address@hidden -
- 155 S 1400 E RM 233 address@hidden -
- Salt Lake City, UT 84112-0090, USA URL: http://www.math.utah.edu/~beebe -
-------------------------------------------------------------------------------
_______________________________________________
Bug-bison mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/bug-bison