%general-entities; ]> gcc-libstdc++ &gcc-version;
&gcc-url;
Libstdc++ from GCC-&gcc-version; GCC tools, libstdc++ pass 1 <para>Libstdc++ is the standard C++ library. It is needed to compile C++ code (part of GCC is written in C++), but we had to defer its installation when we built <xref linkend="ch-tools-gcc-pass1"/> because it depends on glibc, which was not yet available in the target directory. </para> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> <seg>&libstdcpp-tmpp1-sbu;</seg> <seg>&libstdcpp-tmpp1-du;</seg> </seglistitem> </segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Target Libstdc++ Libstdc++ is part of the GCC sources. You should first unpack the GCC tarball and change to the gcc-&gcc-version; directory. Create a separate build directory for libstdc++ and enter it: mkdir -v build cd build Prepare libstdc++ for compilation: ../libstdc++-v3/configure \ --host=$LFS_TGT \ --build=$(../config.guess) \ --prefix=/usr \ --disable-multilib \ --disable-nls \ --disable-libstdcxx-pch \ --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version; The meaning of the configure options: --host=... Specifies that the cross compiler we have just built should be used instead of the one in /usr/bin. --disable-multilib Even when building the multilib version, this switch is given. This is because the additionally built libraries are not required in this stage and some disk space and compile time can be saved. --disable-libstdcxx-pch This switch prevents the installation of precompiled include files, which are not needed at this stage. --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version; This specifies the installation directory for include files. Because libstdc++ is the standard C++ library for LFS, this directory should match the location where the C++ compiler ($LFS_TGT-g++) would search for the standard C++ include files. In a normal build, this information is automatically passed to the libstdc++ configure options from the top level directory. In our case, this information must be explicitly given. The C++ compiler will prepend the sysroot path $LFS (specified building GCC pass 1) to the include file search path, so it will actually search in $LFS/tools/$LFS_TGT/include/c++/&gcc-version;. The combination of the DESTDIR variable (in the make install command below) and this switch ensures to install the headers there. Compile libstdc++ by running: make Install the library: make DESTDIR=$LFS install <para>Details on this package are located in <xref linkend="contents-gcc" role="."/></para> </sect2> </sect1>