星期四, 十一月 16, 2006

jhalfs-1.0 LFS trouble shooting

参照:
http://chowroc.blogspot.com/2006/10/jhalfs-clfs.html
进行配置,注意这里是 LFS 而不是 CLFS。所以运行:
# ./lfs -B 6.2 -D /mnt/lfs -K ~lfs/skeleton/linux-kernel-config -F ~lfs/skeleton/etc/fstab -G -T 0 -M

但是编译 028-binutils-pass1 时出错,gcc 报告 /tools/bin/ld 的 --hash-style=gnu 无效:
gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -o ld-new ldgram.o ldlex.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_i386.o ei386linux.o ../bfd/.libs/libbfd.a ../libiberty/libiberty.a
/tools/bin/ld: unrecognized option '--hash-style=gnu'
/tools/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status
make[2]: *** [ld-new] Error 1
make[2]: Leaving directory `/mnt/lfs/sources/binutils-build/ld'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/mnt/lfs/sources/binutils-build/ld'
make: *** [all-recursive-am] Error 2
make: Leaving directory `/mnt/lfs/sources/binutils-build/ld'

再次编译,configure 报告 compiler 不能 work,"can't create executables":
checking for gcc... gcc
checking whether the C compiler (gcc ) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.

于是排错,发现 $LFS/jhalfs/lfs-commands/chapter04/022-addinguser 有 useradd 和 groupadd 命令,但之前已经创建了用户,所以肯定会出错,那么后面的:
chown -v lfs $LFS/tools
chown -v lfs $LFS/sources
两个命令就无法运行,权限检查的结果也是如此,$LFS/sources的属主没有被更改。

进一步,发现 $LFS/jhalfs/lfs-commands/chapter04/023-settingenvironment 没有产生实际的效果,在 ~lfs 下没有相应的 .bashrc 和 .bash_profile。显然,set +h 没有运行,所以这可能是导致报告 ld --hash-style=gnu 无法识别的原因吗?

于是手工添加了 ~lfs/.bashrc 和 ~/.bash_profile,再在 $LFS/jhalfs 下运行 make,但结果好像是整个进程挂起了,编译 binutils 一小时都没有结果,而手工编译却只要几分钟就结束了。查看进程树得到如下显示:
mlterm
\_ bash
\_ su -
\_ -bash
\_ make
\_ /bin/sh -c ( time { su - lfs -c "source /home/lfs/.bashrc && /mnt/lfs/jhalfs/lfs-commands/chapter05/028-binutils-pass1" >>logs/028-binutils-pass1 2>&1 ; } ) 2>>logs/028-binutils-pass1 && \?echo -e "\nKB: `du -skx --exclude=jhalfs /mnt/lfs`\n" >>logs/028-binutils-pass1
\_ /bin/sh -c ( time { su - lfs -c "source /home/lfs/.bashrc && /mnt/lfs/jhalfs/lfs-commands/chapter05/028-binutils-pass1" >>logs/028-binutils-pass1 2>&1 ; } ) 2>>logs/028-binutils-pass1 && \?echo -e "\nKB: `du -skx --exclude=jhalfs /mnt/lfs`\n" >>logs/028-binutils-pass1
\_ su - lfs -c source /home/lfs/.bashrc && /mnt/lfs/jhalfs/lfs-commands/chapter05/028-binutils-pass1
\_ /bin/bash
/bin/bash ./progress_bar.sh 028-binutils-pass1
\_ sleep .12
好像是启动了一个 /bin/bash 但没有调用任何命令。

目录树是用如下方法得到的:
$ echo "roc 15754 0.0 0.5 10588 1344 ? S 16:16 0:01" | wc
1 10 65
$ ps auxf | cut -b 65-
(当然也可以用 pstree)

这是在 Fedora Core 6 环境下构建的,之后尝试 jhalfs-1.0 CLFS i386 却可以通过 binutils-pass1 这一段;并且最后通过使用 lfs-livecd 完成了安装!

所以只能推测是版本或平台的问题,可能是 FC6 太新,gcc-4.1.1 于 binutils-2.16.1 不能正确匹配(livecd 是 gcc-4.0.3)的原因。

没有评论: