Linux From Scratch [3]

时间:2025-02-06 00:06:38

1. 为了编译glibc,我们需要kernel header。

make mrproper # clean kernel tree

make INSTALL_HDR_PATH=dest headers_install

cp -rv dest/include/* /tools/include

2. 现在开始编译glibc。

mkdir -v build

cd build    # glibc say不要在源代码目录下编译gcc

../configure \
> --prefix=/tools \
> --host=$LFS_TGT \
> --build=$(../scripts/config.guess) \
> --disable-profile \
> --enable-kernel=2.6.32 \
> --enable-obsolete-rpc \
> --with-headers=/tools/include \
> libc_cv_forced_unwind=yes \
> libc_cv_ctors_header=yes \
> libc_cv_c_cleanup=yes

# glibc使用../scripts/config.guess“猜测”她要用的compiler(事实上几乎所有configure script都会这么用)

# 但在此之前我们指定了--host=$LFS_TGT,所以config.guess会“猜测”出要用我们的lfs compiler并写入makefile

# 使用我们之前编译出的gcc和刚展开的kernel header

# --enable-obsolete-rpc将安装NIS和RPC header,在后面编译gcc时需要用到这些

make

make install