LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1053|回复: 5

jhalfs-1.0 LFS: su - lfs 后调用 /bin/bash 就停止了?

[复制链接]
发表于 2006-11-16 21:22:56 | 显示全部楼层 |阅读模式
使用 jhalfs-1.0 编译 LFS,我以前用 jhalfs-1.0 编译 CLFS 成功了,这次需要编译 LFS,按照以前的方法配置好了,然后运行:
# ./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 一小时都没有结果,而手工编译却只要几分钟就结束了。查看进程树得到如下显示:
  1. mlterm
  2. \_ bash
  3.      \_ su -
  4.          \_ -bash
  5.              \_ make
  6.                  \_ /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
  7.                      \_ /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
  8.                          \_ su - lfs -c source /home/lfs/.bashrc && /mnt/lfs/jhalfs/lfs-commands/chapter05/028-binutils-pass1
  9.                              \_ /bin/bash
  10. /bin/bash ./progress_bar.sh 028-binutils-pass1
  11. \_ 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-
 楼主| 发表于 2006-11-16 21:59:16 | 显示全部楼层
# cat /mnt/lfs/jhalfs/logs/028-binutils-pass1

2006年 11月 16日 星期四 20:51:12 CST

KB: 612032  /mnt/lfs

Session terminated, killing shell... ...killed.

real    27m37.863s
user    0m0.008s
sys 0m0.004s

没有任何输出。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-11-16 22:14:32 | 显示全部楼层
换用 jhalfs-2.0 吧,但是 make 后得到如下报错:
Looks like /mnt/lfs was not populated by a previous jhalfs run.

<jhalfs 2.0> exit

好像是因为 /mnt/lfs 是空的,而如果我之前运行了一次 jhalfs-1.0,虽然不能成功编译,但再运行 jhalfs-2.0 却可以继续下去。

这又是为什么?
回复 支持 反对

使用道具 举报

发表于 2006-11-16 22:19:29 | 显示全部楼层
哈哈,刚刚用jhalfs1.0编译好了lfs6.2
不知道你以前做clfs的时候还有现在是怎么配置的
想不清你为什么自己要先建立lfs用户了?这些都交给jhalfs得了啊
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-11-16 22:31:46 | 显示全部楼层
我后来是试过删除 lfs 用户然后再做的,还是一样的结果。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-11-17 21:59:34 | 显示全部楼层
原来是在 Fedora Core 6 上面不行,换用 lfslivecd 则可以了,而且我尝试了一下 clfs,也可以。估计是 gcc 的版本太高活 target 的问题?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表