Subject: 2.4 : triggers libc "nlist > 1" assertion failure from --link in 'setarch i686' environment

From: Jason Vas Dias <[email-masked]>
Date: Fri, 22 Apr 2011 17:42:32 +0100

Hi Gordon, bug-libtool members - this is my first post to this list,
so please reply to : [email-masked]

I believe I may have found a libtool (or possibly a libtool-triggered
glibc or binutils) bug :

In a "setarch i686" environment on a linux-x86_64 host, where
EVERYTHING (more or less) is at the latest
available stable upstream version - especially :

$ setarch i686
$ echo eval $(echo "307  export CC=/usr/bin/gcc' -m32'
  308  export GCC=/usr/bin/gcc' -m32'
  309  export CXX=/usr/bin/g++' -m32'
  310  export LD=/usr/bin/ld' -melf_i386'
  311  export AS=/usr/bin/as' -32'
  313  export CFLAGS='-march=i686 -mtune=generic -g -O2 -fPIC -DPIC
-Wa,--compress-debug-sections'
  314  export LDFLAGS='-Wl,-L/usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.0/32,-L/usr/lib64/gcc/x86_64-pc-linux-gnu/lib32,-L/usr/lib32,-L/lib32,-R/usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.0/32:/usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.0/lib32:/usr/lib32:/lib32,--dynamic-linker,/lib32/ld-linux.so.2'
" | sed 's/^[\ \        ]*[0-9]*[\ \    ]*//'); export
PKG_CONFIG_PATH=/usr/lib32/pkgconfig/; export
PATH=/bin/32:/usr/bin/32:/bin:/usr/bin:/sbin/32:/usr/sbin/32
eval export CC=/usr/bin/gcc' -m32' export GCC=/usr/bin/gcc' -m32'
export CXX=/usr/bin/g++' -m32' export LD=/usr/bin/ld' -melf_i386'
export AS=/usr/bin/as' -32' export CFLAGS='-march=i686 -mtune=generic
-g -O2 -fPIC -DPIC -Wa,--compress-debug-sections' export
LDFLAGS='-Wl,-L/usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.0/32,-L/usr/lib64/gcc/x86_64-pc-linux-gnu/lib32,-L/usr/lib32,-L/lib32,-R/usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.0/32:/usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.0/lib32:/usr/lib32:/lib32,--dynamic-linker,/lib32/ld-linux.so.2'
$ ( $CC --version;  $LD --version;  $AS --version; ldconfig --version;
libtool --version; autoconf --version; automake --version ) | egrep
'[(]G'
gcc (GCC) 4.6.0
GNU ld (GNU Binutils) 2.21.51.20110407
GNU assembler (GNU Binutils) 2.21.51.20110407
ldconfig (GNU libc) 2.13
libtool (GNU libtool) 2.4
autoconf (GNU Autoconf) 2.68
automake (GNU automake) 1.10.3

$ $(CC) --print-multi-os-directory
../lib32

I do for instance :

$  /usr/src/poppler/configure --prefix=/usr --libdir=/usr/lib32
....

but make fails :

$ make
  CXXLD  libgoo.la
Inconsistency detected by ld.so: dl-deps.c: 622: _dl_map_object_deps:
Assertion `nlist > 1' failed!
make: *** [libgoo.la] Error 127

but I can do:

$ cd goo/.libs
$ /usr/bin/g++ -m32  -shared -Wall -Wno-write-strings
-Woverloaded-virtual -Wnon-virtual-dtor -Wcast-align -fno-exceptions
-fno-check-new -fno-common -g -O2 -ansi
-Wl,-L/usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.0/32,-L/usr/lib64/gcc/x86_64-pc-linux-gnu/lib32,-L/usr/lib32,-L/lib32,-R/usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.0/32:/usr/lib64/gcc/x86_64-pc-linux-gnu/4.6.0/lib32:/usr/lib32:/lib32,--dynamic-linker,/lib32/ld-linux.so.2
-o libgoo.so  $(echo gfile.lo gmempp.lo GooHash.lo GooList.lo
GooTimer.lo GooString.lo gmem.lo FixedPoint.lo PNGWriter.lo
JpegWriter.lo TiffWriter.lo ImgWriter.lo gstrtod.lo | sed
's/\.l/./g') -ltiff -ljpeg -lpng
$ ls -l libgoo.so ; file libgoo.so
-rwxr-xr-x 1 root root 151006 Apr 22 17:23 libgoo.so
libgoo.so: ELF 32-bit LSB shared object, Intel 80386, version 1
(SYSV), dynamically linked, not stripped

So what is libtool trying to do here that my command isn't ?

Whatever it is, glibc-2.13 doesn't like it, or it caused binutils to
produce a nasty object that glibc doesn't like.

Any advice / suggestions would be much appreciated. Obviously, I'll
have to 'strace -f -e trace=execve make' . If you'd be interested in
the log, I'll post it.

Incidentally, I had to :
$ rm ./libtool
after the poppler configure, else I got lots of errors :
$ make -j2
make  all-recursive
make[1]: Entering directory `/tmp/poppler'
Making all in goo
make[2]: Entering directory `/tmp/poppler/goo'
  CXX    gfile.lo
  CXX    gmempp.lo
../libtool: line 42: -32: command not found
../libtool: line 42: -32: command not found
  CXX    GooHash.lo
../libtool: line 42: -32: command not found
  CXX    GooList.lo
../libtool: line 42: -32: command not found

But if I remove what was generated during configure as ../libtool
(from goo/) , no such messages appear.

Thank you for the otherwise great libtool and in advance for any replies !
All the best,
Jason