Details on this package are located in Section 6.19.2, “Contents of GCC.”
Libstdc++ is the standard C++ library. It is needed for the correct operation of the g++ compiler.
Libstdc++ is part of the GCC
sources. You should first unpack the GCC tarball and change to
the gcc-4.9.2
directory.
Create a directory for Libstdc++ and enter it:
mkdir -pv ../gcc-build cd ../gcc-build
Prepare Libstdc++ for 32-bit compilation:
../gcc-4.9.2/libstdc++-v3/configure \ --host=$LFS_TGT32 \ --prefix=/tools \ --libdir=/tools/lib32 \ --disable-multilib \ --disable-shared \ --disable-nls \ --disable-libstdcxx-threads \ --disable-libstdcxx-pch \ --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/4.9.2 \ CC="$LFS_TGT-gcc -m32" \ CXX="$LFS_TGT-g++ -m32"
The meaning of the configure options:
--host=...
Indicates to use the cross compiler we have just built
instead of the one in /usr/bin
.
--libdir=/tools/lib32
Installs the 32-bit library files to /tools/lib32
.
--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/$LFS_TGT/include/c++/4.9.2
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 explicitly given.
CC="$LFS_TGT-gcc
-m32", CXX="$LFS_TGT-g++ -m32"
Ensures that the GCC compiler builds 32-bit libraries.
Compile libstdc++ by running:
make
Install the library:
make install
Clean up the build folder before moving on to the next platform:
rm -fr *
Prepare Libstdc++ for x32 ABI compilation:
../gcc-4.9.2/libstdc++-v3/configure \ --host=$LFS_TGTX32 \ --prefix=/tools \ --libdir=/tools/libx32 \ --disable-multilib \ --disable-shared \ --disable-nls \ --disable-libstdcxx-threads \ --disable-libstdcxx-pch \ --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/4.9.2 \ CC="$LFS_TGT-gcc -mx32" \ CXX="$LFS_TGT-g++ -mx32"
The meaning of the configure options:
--host=...
Indicates to use the cross compiler we have just built
instead of the one in /usr/bin
.
--libdir=/tools/libx32
Installs the 32-bit library files to /tools/libx32
.
--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/$LFS_TGT/include/c++/4.9.2
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 explicitly given.
CC="$LFS_TGT-gcc
-mx32", CXX="$LFS_TGT-g++ -mx32"
Ensures that the GCC compiler builds x32 ABI libraries.
Compile libstdc++ by running:
make
Install the library:
make install
Clean up the build folder before moving on to the next platform:
rm -fr *
Prepare Libstdc++ for 64-bit compilation:
../gcc-4.9.2/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.9.2
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/$LFS_TGT/include/c++/4.9.2
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 explicitly given.
Compile libstdc++ by running:
make
Install the library:
make install
Details on this package are located in Section 6.19.2, “Contents of GCC.”