Building gcc10 against glibc+sysroot

Oleg Smolsky osmolsky@netskope.com
Thu Mar 11 01:46:18 GMT 2021


So far, I have figured out a workaround: --disable-bootstrap lets me get a
working compiler.

Yet I would like to check whether this recipe follows the normal "gcc
inside a sysroot" setup. It's a Linux-to-Linux cross-compiler (well, not
really a cross-compiler as "host" and "target" are almost the same).

On Tue, Mar 9, 2021 at 8:24 AM Oleg Smolsky <osmolsky@netskope.com> wrote:

> Hello, I've built glibc 2.33 with a stand-alone version of GCC10 this way:
>
> PATH=$gcc/bin:$PATH ../configure \
>      --prefix=/usr --libdir=/usr/lib \
>      --host=x86_64-unknown-linux --enable-kernel=4.15.1 \
>      --with-headers=$sysroot/usr/include
>
> make -k install-headers cross_compiling=yes install_root=$sysroot
> make
> make install_root=$sysroot install
>
> Now I'm trying to build GCC10 against that glibc/sysroot:
>
> linker="-Wl,--dynamic-linker,$sysroot/lib64/ld-linux-x86-64.so.2"
> rpath=",--rpath,$sysroot/lib64"
>
> LDFLAGS="$linker$rpath" ../configure \
>      --prefix=$destination \
>      --enable-languages=c,c++ \
>      --enable-gold=default \
>      --disable-multilib \
>      --with-sysroot=$sysroot
>
> Things progress for a while... until I hit an issue with
> `build/genmatch`. I see two executables in the tree: the first has the
> right glibc baked in with rpath, and the second does not:
>
> $ ldd ./gcc-build/prev-gcc/build/genmatch
>          linux-vdso.so.1 =>  (0x00007fffe51d1000)
>          libc.so.6 => /opt/sysroot/lib64/libc.so.6 (0x00007f88bfa10000)
>          /opt/sysroot/lib64/ld-linux-x86-64.so.2 =>
> /lib64/ld-linux-x86-64.so.2 (0x00007f88bfdd3000)
>
> $ ldd ./gcc-build/gcc/build/genmatch
> ./gcc-build/gcc/build/genmatch: /lib/x86_64-linux-gnu/libc.so.6: version
> `GLIBC_2.33' not found (required by ./gcc-build/gcc/build/genmatch)
>          linux-vdso.so.1 =>  (0x00007ffdc8bf1000)
>          libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f222fa33000)
>          libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f222f669000)
>          /lib64/ld-linux-x86-64.so.2 (0x00007f222fd3c000)
>
> The second one breaks the build. I can only guess that the LDFLAGS value
> I'm trying to squeeze through the entire build process got lost
> somewhere...
>
> Could someone give me a pointer as to how this kind of sysroot
> arrangement is supposed to function please? This recipe worked with
> older versions of GCC and GLibc... but that does not help much.
>
> Thanks in advance,
> Oleg.
>
>


More information about the Gcc-help mailing list