5.8. Libstdc++-4.8.1

Libstdc++ is the standard C++ library. It is needed for the correct operation of the g++ compiler.

Approximate build time: 0.4 SBU
Required disk space: 734 MB

5.8.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-4.8.1 directory.

Create a directory for Libstdc++ and enter it:

mkdir -pv ../gcc-build
cd ../gcc-build

Prepare Libstdc++ for compilation:

../gcc-4.8.1/libstdc++-v3/configure \
    --host=$LFS_TGT                      \
    --prefix=/tools                      \
    --disable-multilib                   \
    --disable-shared                     \
    --disable-nls                        \
    --disable-libstdcxx-threads          \
    --disable-libstdcxx-pch              \
    --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/4.8.1

The meaning of the configure options:

--host=...

Indicates to use the cross compiler we have just built instead of the one in /usr/bin.

--disable-libstdcxx-threads

Since we have not built the thread C library, the C++ one cannot be built as well.

--disable-libstdcxx-pch

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

--with-gxx-include-dir=/tools/include/c++/4.8.1

This is the location where the standard include files are searched by the C++ compiler. In a normal build, this information is automatically passed to the Libstdc++ configure options from the toplevel directory. In our case, this information must be explicitely given.

Compile libstdc++ by running:

make

Install the library:

make install

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