LFS GCC-14.2.0 中的 Libstdc++

Libstdc++ 是 C++ 标准库,需要它才能编译 C++ 代码 (GCC 的一部分用 C++ 编写)。但在构建第一遍的 GCC时我们不得不暂缓安装它,因为 Libstdc++ 依赖于当时还没有安装到目标目录的 Glibc。

安装目标系统的 Libstdc++
cd $LFS/sources

VERSION=14.2.0
tar xf gcc-${VERSION}.tar.xz
cd gcc-${VERSION}

mkdir -v build
cd       build

../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++/${VERSION}

# 编译Libstdc++
make
# 安装库
make DESTDIR=$LFS install

#  移除对交叉编译有害的 libtool 档案文件
rm -v $LFS/usr/lib/lib{stdc++{,exp,fs},supc++}.la