编译LFS系统时coreutils 9.4因help2man报错失败的解决求助
LFS coreutils构建失败:help2man无法获取--help信息
问题概述
构建LFS系统到coreutils步骤时,编译完成man/nice.1后构建终止,报错原因是help2man无法从man/chroot.td/chroot、man/timeout.td/timeout、man/nice.td/nice这些程序的--help命令中收集信息。
错误输出
CCLD src/getlimits GEN man/chroot.1 GEN man/hostid.1 GEN man/timeout.1 GEN man/nice.1 help2man: can't get `--help' info from man/chroot.td/chroot Try `--no-discard-stderr' if option outputs to stderr make[2]: *** [Makefile:27782: man/chroot.1] Error 1 make[2]: *** Waiting for unfinished jobs.... help2man: can't get `--help' info from man/timeout.td/timeout Try `--no-discard-stderr' if option outputs to stderr help2man: can't get `--help' info from man/nice.td/nice Try `--no-discard-stderr' if option outputs to stderr make[2]: *** [Makefile:27782: man/timeout.1] Error 1 make[2]: *** [Makefile:27782: man/nice.1] Error 1 make[2]: Leaving directory '/media/ben/6a03968c-3859-4041-8752-2a48c34214f6/sources/coreutils' make[1]: *** [Makefile:22396: all-recursive] Error 1 make[1]: Leaving directory '/media/ben/6a03968c-3859-4041-8752-2a48c34214f6/sources/coreutils' make: *** [Makefile:8835: all] Error 2
使用的configure选项
./configure --prefix=/usr \ --host=$LFS_TGT \ --build=$(build-aux/config.guess) \ --enable-install-program=hostname \ --enable-no-install-program=kill,uptime
已尝试的操作
- 按照LFS手册8.57.2章节描述运行补丁
- 重新下载coreutils 9.4
- 更新help2man
可行解决方法
方法一:完全禁用man页生成
在configure阶段添加--disable-man选项,跳过所有man页的生成流程,彻底绕开help2man的调用:
./configure --prefix=/usr \ --host=$LFS_TGT \ --build=$(build-aux/config.guess) \ --enable-install-program=hostname \ --enable-no-install-program=kill,uptime \ --disable-man
执行完configure后重新运行make即可。
方法二:强制跳过help2man步骤
交叉编译时,生成的测试程序是针对LFS目标系统的,无法在当前宿主系统运行,导致help2man无法获取--help输出。可以通过设置环境变量让make跳过这一步:
make HELP2MAN=true
也可以在configure阶段直接指定该变量:
HELP2MAN=true ./configure --prefix=/usr \ --host=$LFS_TGT \ --build=$(build-aux/config.guess) \ --enable-install-program=hostname \ --enable-no-install-program=kill,uptime
方法三:使用预生成man页(可选)
如果需要保留man页,可以下载对应版本coreutils的预生成man页包,解压后将man页放到指定目录,再执行构建时跳过生成步骤。此方法相对繁琐,仅推荐有需求的场景使用。
内容的提问来源于stack exchange,提问作者Ben Daws
相关产品推荐
相关产品推荐

