+ -
当前位置:首页 → 问答吧 → 请问各位高人一个sed命令!

请问各位高人一个sed命令!

时间:2008-04-17

来源:互联网

sed -i \
's|libs -o|libs -L/usr/lib-Wl,-dynamic-linker=/lib/ld-linux.so.2 -o|' \
scripts/test-installation.pl
如题,谢谢!

作者: longkz   发布时间: 2008-04-17

在lfs6.2的6.9小节:
root:/sources/glibc-2.3.6# sed -i \
> 's|libs -o|libs -L/usr/lib-W1,-dynamic-linker=/lib/ld-linux.so.2 \
> -o| ' scripts/test-installation.pl
root:/sources/glibc-2.3.6#
执行之后,在test-installation.pl之中只有以下最有可能是:
open GCC, "$CC /tmp/test-prg$$.c $link_libs -L/usr/lib -W1,-dynamic-linker=/lib/ld-linux.so.2
-o /tmp/test-prg$$ 2>&1 |"
or die ("Couldn't execute $CC!");
哪位大侠能解释一下是怎么回事阿?

作者: longkz   发布时间: 2008-04-17

果然出错了,make install 后:
CC="gcc" /usr/bin/perl scripts/test-installation.pl /sources/glibc-build/
cc1: error: unrecognized command line option "-W1,-dynamic-linker=/lib/ld-linux.so.2"
sh: line 1: -o: command not found
Execution of gcc failed!
The script has found some problems with your installation!
Please read the FAQ and the README file and check the following:
- Did you change the gcc specs file (necessary after upgrading from
Linux libc5)?
- Are there any symbolic links of the form libXXX.so to old libraries? Links like libm.so -> libm.so.5 (where libm.so.5 is an old library) are wrong,
libm.so should point to the newly installed glibc file - and there should be
only one such link (check e.g. /lib and /usr/lib)
You should restart this script from your build directory after you've
fixed all problems!
Btw. the script doesn't work if you're installing GNU libc not as yourprimary library!
make[1]: *** [install] Error 1
make[1]: Leaving directory `/sources/glibc-2.3.6'
make: *** [install] Error 2
root:/sources/glibc-build#
怎么论坛人这么少阿??

作者: longkz   发布时间: 2008-04-17

是-Wl(小写的L,不是1),开始我想当然的把它当作了gcc的警告等级,也在这里搞了半天

作者: waiting4you   发布时间: 2008-04-17

那现在怎么办那 ?

作者: longkz   发布时间: 2008-04-17

再用sed修改一下

sed -i 's|-W1,|-Wl,|' scripts/test-installation.pl

第一个是数字1,第二个是小写的L,它的作用就是把你写错了的-W1,改成正确的-Wl.
然后直接make install就可以了,这个文件只影响安装,不需要重编译了.

作者: waiting4you   发布时间: 2008-04-18

多谢,可惜我不会sed,我是用vi改的!

作者: longkz   发布时间: 2008-04-18