[Aboriginal] Interesting case of aboriginal build failure

Denys Vlasenko vda.linux at googlemail.com
Sat Mar 17 13:35:23 PDT 2012

I've got a native-compiler build failure,
dug a bit deeper, and here what I found:

The failure happens when we try to run libstdc++-v3 configure.
I added a shell invocation to experiment
interactively just before failing command:


       srcdiroption="--srcdir=$${topdir}/libstdc++-v3"; \
       libsrcdir="$$s/libstdc++-v3"; \
       rm -f no-such-file || : ; \
DBG==>  sh </dev/tty >/dev/tty 2>&1; \
FAIL=>  CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
         $(TARGET_CONFIGARGS) $${srcdiroption}  \
         || exit 1
@endif target-libstdc++-v3

So, I sit in my debug sh session:

$ ls -l /bin/sh
lrwxrwxrwx    1 root     root             4 Dec  7 15:39 /bin/sh -> bash
ls -l /bin/bash
-rwxr-xr-x    1 root     root        888112 Nov 24 23:00 /bin/bash

Invocation of /bin/sh by configure script's #!/bin/sh
will try to load my host's /bin/bash. The problem is,

(running in another, ordinary host shell w/o tweaked environment,
so that /usr/bin/ldd is accessible and works:)
$ ldd /bin/bash
       linux-gate.so.1 =>  (0xb776d000)
       libtinfo.so.5 => /lib/libtinfo.so.5 (0x4bcc8000)
       libdl.so.2 => /lib/libdl.so.2 (0xb7754000)
       libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x4b017000)
       libc.so.6 => /lib/libc.so.6 (0xb75a6000)
       /lib/ld-linux.so.2 (0xb776e000)

At this point in build process LD_LIBRARY_PATH is set:

$ env | grep LIBRARY

and the following file exists:


Second-to-last LD_LIBRARY_PATH element points to that dir.
Attempt to load /bin/sh -> /bin/bash will load wrong libgcc_s.so.1,
and we end up with:

/bin/sh: error while loading shared libraries: libc.so.0: cannot open
shared object file: No such file or directory


More information about the Aboriginal mailing list