7.7. Libstdc++ from GCC-10.1.0, Pass 2

When building Section 6.18, “GCC-10.1.0 - Pass 2” we had to defer the installation of the C++ standard library because no suitable compiler was available to compile it. We could not use the compiler built in that section because it is a native compiler and should not be used outside of chroot and risks polluting the libraries with some host components.

Approximate build time: 1.1 SBU
Required disk space: 1.1 GB

7.7.1. Installation of Target Libstdc++

[Note]

Note

Libstdc++ is part of the GCC sources. You should first unpack the GCC tarball and change to the gcc-10.1.0 directory.

Create a link which exists when building libstdc++ in the gcc tree:

ln -s gthr-posix.h libgcc/gthr-default.h

Create a separate build directory for libstdc++ and enter it:

mkdir -v build
cd       build

Prepare libstdc++ for compilation:

../libstdc++-v3/configure           \
    CXXFLAGS="-g -O2 -D_GNU_SOURCE" \
    --prefix=/usr                   \
    --disable-multilib              \
    --disable-nls                   \
    --disable-libstdcxx-pch

The meaning of the configure options:

CXXFLAGS="-g -O2 -D_GNU_SOURCE"

These flags are passed by the top level Makefile when doing a full build of GCC.

--disable-libstdcxx-pch

This switch prevents the installation of precompiled include files, which are not needed at this stage.

Compile libstdc++ by running:

make

Install the library:

make install

Details on this package are located in Section 8.22.2, “Contents of GCC.”