我正在按照《Linux From Scratch》(版本 r12.3-103,发布日期 2025年8月9日)进行构建,并在我的宿主机(Ubuntu 22.04,gcc 11.4.0)上交叉编译临时工具。
1.m4-1.4.20 编译
在编译 m4-1.4.20 时,我使用的脚本如下:
./configure --prefix=/usr \ --host=$LFS_TGT \ --build=$(./build-aux/config.guess) \ && make -j$(nproc) \ && make DESTDIR=$LFS install
但是在 make 阶段遇到了如下错误:make[2]: Entering directory '/mnt/lfs/sources/m4-1.4.20/doc' Updating man page m4.1 help2man: can't get --help' info from ../src/m4
Try --no-discard-stderr' if option outputs to stderr make[2]: *** [Makefile:2960: m4.1] Error 2
根据 LFS 手册,这个问题不应该出现,所以我不确定为什么会在我的系统上发生。
因为我只是交叉编译临时工具,我想跳过 help2man 这个步骤。我尝试了:
在 make 之后运行 make help2man=:
通过修改 Makefile 添加 --no-discard-stderr 参数,执行命令:sed -i '/\$(HELP2MAN)/ s/$(HELP2MAN)/$(HELP2MAN) --no-discard-stderr/' doc/Makefile.am
但是这些方法都没能解决问题。
2.diffutils-3.12 编译
在编译 diffutils-3.12 时,我使用的脚本如下:./configure --prefix=/usr \ --host=$LFS_TGT \ gl_cv_func_strcasecmp_works=y \ --build=$(./build-aux/config.guess) \ && make -j$(nproc) \ && make DESTDIR=$LFS install
但是在 make 阶段遇到如下错误:help2man: can't get --help' info from sdiff
Try --no-discard-stderr' if option outputs to stderr help2man: can't get --help' info from cmp
Try --no-discard-stderr' if option outputs to stderr help2man: can't get --help' info from diff
Try --no-discard-stderr' if option outputs to stderr make[1]: *** [Makefile:2574: sdiff.1] Error 1 make[1]: *** Waiting for unfinished jobs.... make[1]: *** [Makefile:2574: cmp.1] Error 1 make[1]: *** [Makefile:2574: diff.1] Error 1 make[1]: Leaving directory '/mnt/lfs/sources/diffutils-3.12/man' make: *** [Makefile:2437: all-recursive] Error 1
根据 LFS 手册,这个问题不应该在标准构建中出现。
我尝试了多种方法来跳过或修复该问题,包括:
make HELP2MAN=: 或 make HELP2MAN=true
使用 HELP2MAN="help2man --no-discard-stderr" 运行 make
在构建前导出环境变量 HELP2MAN=: 或 HELP2MAN=true
但均未解决问题。
问题:
这个问题是否可能与我的宿主环境有关?
在 LFS 交叉编译临时工具阶段,如何正确跳过或修复 help2man 相关的编译错误?
非常感谢大家的时间和帮助!