GNU bug report logs - #10231
libtool.m4 makes the wrong shell (dash) run libtool

Previous Next

Package: libtool;

Reported by: Hallvard B Furuseth <h.b.furuseth <at> usit.uio.no>

Date: Tue, 6 Dec 2011 12:01:02 UTC

Severity: normal

Merged with 10303

Full log


View this message in rfc822 format

From: Hallvard B Furuseth <h.b.furuseth <at> usit.uio.no>
To: 10231 <at> debbugs.gnu.org
Subject: bug#10231: libtool.m4 makes the wrong shell (dash) run libtool
Date: Tue, 06 Dec 2011 12:59:52 +0100
This is an old bug by now, but the reports I've seen do not seem to
get at all of it.

libtool.m4:LT_INIT says LIBTOOL='$(SHELL) $(top_builddir)/libtool'.
Gnu Make exports SHELL=/bin/sh.  Maybe other Makes too, I do not know.

Thus even when a package is configured and built with the same $SHELL,
the libtool script can get run by another shell than it was built for.
This breaks when libtool is built as a bash script using '+=', but
$(SHELL) does not support '+='.  In my case: Ubuntu's /bin/sh = dash.

Either the LIBTOOL= line should lose $(SHELL) so the #!<shell> line in
the libtool script takes effect, or it should use e.g. $(LT_SHELL)
which would be set to the shell which libtool was built for, or
libtool should exec itself with its desired shell.  Users should not
have to set CONFIG_SHELL=/bin/sh.

This applies to at least libtoolize 2.4.2 and Ubuntu's patched 2.4.
I'm using aclocal 1.11.1, autoconf 2.68.


Here is a minimized example:

mkdir foo foo/m4
cd    foo
echo 'int main() {return 0;}'	> foo.c

cat <<'EOF'			> Makefile.in
top_builddir = @top_builddir@
foo.o:; @LIBTOOL@ --mode=compile @CC@ -c foo.c
EOF

cat <<'EOF'			> configure.ac
AC_INIT([foo])
AC_CONFIG_AUX_DIR([m4])
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CC
LT_INIT([disable-shared])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
EOF

libtoolize --copy --install --quiet; aclocal -I m4; autoconf
./configure --quiet
cat Makefile; echo "libtool head == `head -1 libtool`"
make

Output:

top_builddir = .
foo.o:; $(SHELL) $(top_builddir)/libtool --mode=compile gcc -c foo.c
libtool head == #! /bin/bash
/bin/sh ./libtool --mode=compile gcc -c foo.c
eval: 1: base_compile+= gcc: not found
eval: 1: base_compile+= -c: not found
libtool: compile: you must specify a compilation command
libtool: compile: Try `libtool --help --mode=compile' for more information.
make: *** [foo.o] Error 1


Any advise as to what to do (other than staying with libtool 1.5)?
For now I use the simplest fix, removing $(SHELL).  Or should
Makefile.in be using something else than @LIBTOOL@?




This bug report was last modified 1 year and 152 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.