[lfs-support] problem building libstdc++ from chapter 5.8. Libstdc++-4.8.2

Michael E. Maher michael at maheronline.co.uk
Mon May 19 15:55:53 PDT 2014


Hello!

On Mon, 2014-05-19 at 16:14 +1000, Durovic, Milan wrote:
> Hi,
> 
>  
> 
> I've come across a strange problem in building libstdc++. Before I
> proceed, let me just say that in my environment I have $LFS set to
> /usr/share/mk7i-toolchain and tools are rooted at
> /usr/share/mk7i-toolchain/tools instead of /tools. I had no problem with
> that when building binutils, gcc pass 1 and glibc. So here's the
> problem:
> 

So just to prefix, deviating from the book will result in funny things
like this, but as long as you're prepared :-P. I guess lfs-chat maybe a
better list than support, anyways...

>  
> 
> The problem happens when executing ../gcc-4.8.2/libstdc++-v3/configure
> line. I get:
> 
>  
> 
> checking dynamic linker characteristics... configure: error: Link tests
> are not allowed after GCC_NO_EXECUTABLES.
> 
>  

This means GCC cannot create an executable for some reason. It is almost
always due to a GCC misconfiguration.

Glibc does special things, so it's really not a good test of "are my
compiler paths sane".

> 
> which can be then tracked in the config.log file to the following
> problem:
> 
>  
> 
> configure:3891: i686-alx-linux-gnu-gcc -o conftest    conftest.c  >&5
> 
> /usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/../../.
> ./../i686-alx-linux-gnu/bin/ld: cannot find crt1.o: No such file or
> directory
> 
> /usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/../../.
> ./../i686-alx-linux-gnu/bin/ld: cannot find crti.o: No such file or
> directory
> 
> /usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/../../.
> ./../i686-alx-linux-gnu/bin/ld: cannot find
> /usr/share/mk7i-toolchain/tools/lib/libc.so.6 inside
> /usr/share/mk7i-toolchain
> 
> /usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/../../.
> ./../i686-alx-linux-gnu/bin/ld: cannot find
> /usr/share/mk7i-toolchain/tools/lib/libc_nonshared.a inside
> /usr/share/mk7i-toolchain
> 
> /usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/../../.
> ./../i686-alx-linux-gnu/bin/ld: cannot find
> /usr/share/mk7i-toolchain/tools/lib/ld-linux.so.2 inside
> /usr/share/mk7i-toolchain
> 
> collect2: error: ld returned 1 exit status
> 
>  
> 
> Now, what's strange about it is that when I check the settings of
> cross-compile tools, things appear as one would expect. For example, the
> 
> 
> default ld program for gnu-gcc is:
> 
>  
> 
> mk7 at mk7i-durovicm:~>
> /usr/share/mk7i-toolchain/tools/bin/i686-alx-linux-gnu-gcc
> -print-prog-name=ld
> 
> /usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/../../.
> ./../i686-alx-linux-gnu/bin/ld
> 
>  

That should be good.

> 
> ... and the built-in search path for this linker is:
> 
>  
> 
> mk7 at mk7i-durovicm:~>
> /usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/../../.
> ./../i686-alx-linux-gnu/bin/ld --verbose|grep SEARCH
> 
> SEARCH_DIR("/usr/share/mk7i-toolchain/tools/lib");
> 
>  

Looks good.

> 
> The confusing bit is that all the files that ld complains about ("No
> such file or directory") are actually right there! For example:
> 
>  
> 
> mk7 at mk7i-durovicm:~> ls -l /usr/share/mk7i-toolchain/tools/lib/crt1.o
> 
> -rw-r--r-- 1 root root 2800 2014-05-19 13:50
> /usr/share/mk7i-toolchain/tools/lib/crt1.o
> 
>  
> 
> So, I'm really stuck here. If it helps, I tried building a small test
> program to trigger the same error, but with more verbose output than
> 
> configure script provides, in order to reveal internal processing.
> Here's what I get:
> 
>  
> 
> -- start quote --
> 
> mk7 at mk7i-durovicm:~>
> /usr/share/mk7i-toolchain/tools/bin/i686-alx-linux-gnu-gcc -v
> -I/usr/share/mk7i-toolchain/tools/include test.c
> 
> Using built-in specs.
> 
> COLLECT_GCC=/usr/share/mk7i-toolchain/tools/bin/i686-alx-linux-gnu-gcc
> 
> COLLECT_LTO_WRAPPER=/usr/share/mk7i-toolchain/tools/libexec/gcc/i686-alx
> -linux-gnu/4.8.2/lto-wrapper
> 
> Target: i686-alx-linux-gnu
> 
> Configured with: ../gcc-4.8.2/configure --target=i686-alx-linux-gnu
> --prefix=/usr/share/mk7i-toolchain/tools
> --with-sysroot=/usr/share/mk7i-toolchain --with-newlib --without-headers
> --with-local-prefix=/usr/share/mk7i-toolchain/tools
> --with-native-system-header-dir=/usr/share/mk7i-toolchain/tools/include
> --disable-nls --disable-shared --disable-multilib
> --disable-decimal-float --disable-threads --disable-libatomic
> --disable-libgomp --disable-libitm --disable-libmudflap
> --disable-libquadmath --disable-libsanitizer --disable-libssp
> --disable-libstdc++-v3 --enable-languages=c,c++

The problem is here in your GCC config. Try:
        --with-sysroot=/

> 
> Thread model: single
> 
> gcc version 4.8.2 (GCC)
> 
> COLLECT_GCC_OPTIONS='-v' '-I' '/usr/share/mk7i-toolchain/tools/include'
> '-mtune=generic' '-march=pentiumpro'
> 
> /usr/share/mk7i-toolchain/tools/libexec/gcc/i686-alx-linux-gnu/4.8.2/cc1
> -quiet -v -I /usr/share/mk7i-toolchain/tools/include test.c -quiet
> -dumpbase test.c -mtune=generic -march=pentiumpro -auxbase test -version
> -o /tmp/ccAoJ9y4.s
> 
> GNU C (GCC) version 4.8.2 (i686-alx-linux-gnu)
> 
>         compiled by GNU C version 4.1.2 20061115 (prerelease) (SUSE
> Linux), GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.2
> 
> GGC heuristics: --param ggc-min-expand=100 --param
> ggc-min-heapsize=131072
> 
> ignoring nonexistent directory
> "/usr/share/mk7i-toolchain/usr/share/mk7i-toolchain/tools/include"

Take this is an example, this is:
        ${SYSROOT}/${INCLUDEDIR}
Where:
        ${SYSROOT} = /usr/share/mk7i-toolchain
        ${INCLUDEDIR} = /usr/share/mk7i-toolchain/tools/include

> 
> ignoring nonexistent directory
>
"/usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/../../
> ../../i686-alx-linux-gnu/include"
> 
> ignoring nonexistent directory
> "/usr/share/mk7i-toolchain/usr/share/mk7i-toolchain/tools/include"
> 
> #include "..." search starts here:
> 
> #include <...> search starts here:
> 
> /usr/share/mk7i-toolchain/tools/include
> 
> /usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/include
> 
> /usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/include
> -fixed
> 
> End of search list.
> 
> GNU C (GCC) version 4.8.2 (i686-alx-linux-gnu)
> 
>         compiled by GNU C version 4.1.2 20061115 (prerelease) (SUSE
> Linux), GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.2
> 
> GGC heuristics: --param ggc-min-expand=100 --param
> ggc-min-heapsize=131072
> 
> Compiler executable checksum: d4ab0d4090ea5fd2277f9bf8e110997e
> 
> COLLECT_GCC_OPTIONS='-v' '-I' '/usr/share/mk7i-toolchain/tools/include'
> '-mtune=generic' '-march=pentiumpro'
> 
> /usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/../../.
> ./../i686-alx-linux-gnu/bin/as -v -I
> /usr/share/mk7i-toolchain/tools/include --32 -o /tmp/ccesbM52.o
> /tmp/ccAoJ9y4.s
> 
> GNU assembler version 2.24 (i686-alx-linux-gnu) using BFD version (GNU
> Binutils) 2.24
> 
> COMPILER_PATH=/usr/share/mk7i-toolchain/tools/libexec/gcc/i686-alx-linux
> -gnu/4.8.2/:/usr/share/mk7i-toolchain/tools/libexec/gcc/i686-alx-linux-g
> nu/4.8.2/:/usr/share/mk7i-toolchain/tools/libexec/gcc/i686-alx-linux-gnu
> /:/usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/:/usr
> /share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/:/usr/share/mk7i-
> toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/../../../../i686-alx-li
> nux-gnu/bin/
> 
> LIBRARY_PATH=/usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/
> 4.8.2/:/usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/
> ../../../../i686-alx-linux-gnu/lib/
> 
> COLLECT_GCC_OPTIONS='-v' '-I' '/usr/share/mk7i-toolchain/tools/include'
> '-mtune=generic' '-march=pentiumpro'
> 
> /usr/share/mk7i-toolchain/tools/libexec/gcc/i686-alx-linux-gnu/4.8.2/col
> lect2 --sysroot=/usr/share/mk7i-toolchain --eh-frame-hdr -m elf_i386
> -dynamic-linker /usr/share/mk7i-toolchain/tools/lib/ld-linux.so.2 crt1.o
> crti.o
> /usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/crtbegi
> n.o -L/usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2
> -L/usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/../..
> /../../i686-alx-linux-gnu/lib /tmp/ccesbM52.o -lgcc -lc -lgcc
> /usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/crtend.
> o crtn.o
> 
> /usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/../../.
> ./../i686-alx-linux-gnu/bin/ld: cannot find crt1.o: No such file or
> directory
> 
> /usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/../../.
> ./../i686-alx-linux-gnu/bin/ld: cannot find crti.o: No such file or
> directory
> 
> /usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/../../.
> ./../i686-alx-linux-gnu/bin/ld: cannot find
> /usr/share/mk7i-toolchain/tools/lib/libc.so.6 inside
> /usr/share/mk7i-toolchain
> 
> /usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/../../.
> ./../i686-alx-linux-gnu/bin/ld: cannot find
> /usr/share/mk7i-toolchain/tools/lib/libc_nonshared.a inside
> /usr/share/mk7i-toolchain
> 
> /usr/share/mk7i-toolchain/tools/lib/gcc/i686-alx-linux-gnu/4.8.2/../../.
> ./../i686-alx-linux-gnu/bin/ld: cannot find
> /usr/share/mk7i-toolchain/tools/lib/ld-linux.so.2 inside
> /usr/share/mk7i-toolchain

This message is meant to be read as:

I'm looking for:
"/usr/share/mk7i-toolchain/usr/share/mk7i-toolchain/tools/lib/ld-linux.so.2"

And I can't find the file
(/usr/share/mk7i-toolchain/tools/lib/ld-linux.so.2) inside the sysroot
(/usr/share/mk7i-toolchain).

> 
> collect2: error: ld returned 1 exit status
> 
> -- end quote --
> 
>  
> 
> Any help or hint are really appreciated. I've checked file permissions,
> paths, just no more clues...
> 
>  

So I would say either, set the sysroot to '/' or follow the book method,
where the '/tools' symlink is created and used for the GCC config
options (prefix, etc).

> Regards,
> 
> Milan
> 

Hope that helps!
Thanks,
Mike




More information about the lfs-support mailing list