LinuxSir.cn,穿越时空的Linuxsir!

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

编译gcc第一遍出错

[复制链接]
发表于 2004-11-20 18:16:23 | 显示全部楼层 |阅读模式
……
/tools/i686-pc-linux-gnu/bin/ld: cannot find -lc
collect2: ld returned 1 exit status
make[2]: *** [gengenrtl] Error 1
make[2]: Leaving directory '/mnt/lfs/sources/gcc-build/gcc'
make[1]: *** [stage2_build] Error 2
make[1]: Leaving directory '/mnt/lfs/sources/gcc-build/gcc'
make: *** [bootstrap] Error 2


以上是出错信息,说找不到/tools/i686-pc-linux-gnu/bin/ld,可是该文件明明是存在的,何解?
发表于 2004-11-24 20:23:49 | 显示全部楼层
我也是第1遍就出问题
郁闷
发表于 2004-11-25 23:44:40 | 显示全部楼层

我的也是,为什么?

-bash-3.00$ make BOOT_LDFLAGS="-static" bootstrap
/bin/sh: -c: line 0: syntax error near unexpected token `cd'
/bin/sh: -c: line 0: `dir=`echo all-libiberty | sed -e 's/all-//'`;  if [ -f ./${dir}/Makefile ] ; then  r=`${PWDCMD-pwd}`; export r;  s=`cd ../gcc-3.3.1; ${PWDCMD-pwd}`; export s;  @SET_LIB_PATH@  (cd ${dir}; make "AR_FLAGS=rc" "AR_FOR_TARGET=` if [ -f $r/binutils/ar ] ; then echo $r/binutils/ar ; else if [ 'i686-pc-linux-gnu' = 'i686-pc-linux-gnu' ] ; then echo ar; else t=''; echo ar | sed -e 's/x/x/' $t ; fi; fi`" "AS_FOR_TARGET=` if [ -f $r/gas/as-new ] ; then echo $r/gas/as-new ; elif [ -f $r/gcc/xgcc ]; then @CC_FOR_TARGET@ -print-prog-name=as ; else if [ 'i686-pc-linux-gnu' = 'i686-pc-linux-gnu' ] ; then echo as; else t=''; echo as | sed -e 's/x/x/' $t ; fi; fi`" "BISON=`if [ -f $r/bison/bison ] ; then echo $r/bison/bison -L $s/bison/ ; else echo bison ; fi`" "CC_FOR_BUILD=gcc" "CC_FOR_TARGET=@CC_FOR_TARGET@" "CFLAGS=-g -O2" "CFLAGS_FOR_TARGET=-O2 -g -O2" "GCJ_FOR_TARGET=@GCJ_FOR_TARGET@" "CXX_FOR_BUILD=c++" "CXXFLAGS=-g -O2" "CXXFLAGS_FOR_TARGET=-g -O2 -D_GNU_SOURCE" "CXX_FOR_TARGET=@CXX_FOR_TARGET@" "DESTDIR=" "DLLTOOL_FOR_TARGET=` if [ -f $r/binutils/dlltool ] ; then echo $r/binutils/dlltool ; else if [ 'i686-pc-linux-gnu' = 'i686-pc-linux-gnu' ] ; then echo dlltool; else t=''; echo dlltool | sed -e 's/x/x/' $t ; fi; fi`" "INSTALL=/bin/sh $s/install-sh -c" "INSTALL_DATA=/bin/sh $s/install-sh -c -m 644" "INSTALL_PROGRAM=/bin/sh $s/install-sh -c " "INSTALL_SCRIPT=/bin/sh $s/install-sh -c" "LDFLAGS=" "LEX=`if [ -f $r/flex/flex ] ; then echo $r/flex/flex ; else echo flex ; fi`" "LD_FOR_TARGET=` if [ -f $r/ld/ld-new ] ; then echo $r/ld/ld-new ; elif [ -f $r/gcc/xgcc ]; then @CC_FOR_TARGET@ -print-prog-name=ld ; else if [ 'i686-pc-linux-gnu' = 'i686-pc-linux-gnu' ] ; then echo ld; else t=''; echo ld | sed -e 's/x/x/' $t ; fi; fi`" "LIBCFLAGS=-g -O2" "LIBCFLAGS_FOR_TARGET=-O2 -g -O2" "LIBCXXFLAGS=-g -O2 -fno-implicit-templates" "LIBCXXFLAGS_FOR_TARGET=-g -O2 -D_GNU_SOURCE -fno-implicit-templates" "M4=`if [ -f $r/m4/m4 ] ; then echo $r/m4/m4 ; else echo m4 ; fi`" "MAKE=make" "MAKEINFO=`if [ -f $r/texinfo/makeinfo/makeinfo ] ; then echo $r/texinfo/makeinfo/makeinfo ; else if (makeinfo --version | egrep 'texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])') >/dev/null 2>&1; then echo makeinfo; else echo $s/missing makeinfo; fi; fi` --no-split" "NM_FOR_TARGET=` if [ -f $r/binutils/nm-new ] ; then echo $r/binutils/nm-new ; elif [ -f $r/gcc/xgcc ]; then @CC_FOR_TARGET@ -print-prog-name=nm ; else if [ 'i686-pc-linux-gnu' = 'i686-pc-linux-gnu' ] ; then echo nm; else t=''; echo nm | sed -e 's/x/x/' $t ; fi; fi`" "RANLIB_FOR_TARGET=` if [ -f $r/binutils/ranlib ] ; then echo $r/binutils/ranlib ; else if [ 'i686-pc-linux-gnu' = 'i686-pc-linux-gnu' ] ; then if [ x'' != x ]; then echo ; else echo ranlib; fi; else t=''; echo ranlib | sed -e 's/x/x/' $t ; fi; fi`" "RPATH_ENVVAR=@RPATH_ENVVAR@" "SHELL=/bin/sh" "EXPECT=`if [ -f $r/expect/expect ] ; then echo $r/expect/expect ; else echo expect ; fi`" "RUNTEST=`if [ -f $s/dejagnu/runtest ] ; then echo $s/dejagnu/runtest ; else echo runtest ; fi`" "RUNTESTFLAGS=" "TARGET_SUBDIR=@target_subdir@" "WINDRES_FOR_TARGET=` if [ -f $r/binutils/windres ] ; then echo $r/binutils/windres ; else if [ 'i686-pc-linux-gnu' = 'i686-pc-linux-gnu' ] ; then echo windres; else t=''; echo windres | sed -e 's/x/x/' $t ; fi; fi`" "YACC=`if [ -f $r/bison/bison ] ; then echo $r/bison/bison -y -L $s/bison/ ; elif [ -f $r/byacc/byacc ] ; then echo $r/byacc/byacc ; else echo bison -y ; fi`" "bindir=/tools/bin" "datadir=/tools/share" "exec_prefix=/tools" "includedir=/tools/include" "infodir=/tools/info" "libdir=/tools/lib" "libexecdir=/tools/libexec" "lispdir=" "libstdcxx_incdir=" "libsubdir=/tools/lib/gcc-lib/i686-pc-linux-gnu/3.3.1" "localstatedir=/tools/var" "mandir=/tools/man" "oldincludedir=/usr/include" "prefix=/tools" "sbindir=/tools/sbin" "sharedstatedir=/tools/com" "sysconfdir=/tools/etc" "tooldir=/tools/i686-pc-linux-gnu" "build_tooldir=/tools/i686-pc-linux-gnu" "gxx_include_dir=@gxx_include_dir@" "gcc_version=3.3.1" "gcc_version_trigger=/mnt/lfs/sources/gcc-3.3.1/gcc/version.c" "target_alias=i686-pc-linux-gnu"  'AR=ar' 'AS=as' 'CC=gcc' 'CXX=c++' 'DLLTOOL=dlltool' 'LD=ld' 'NM=nm' "`echo 'RANLIB=' | sed -e s/.*=$/XFOO=/`" 'WINDRES=windres' all);  else  true;  fi'
make: *** [all-libiberty] Error 2
发表于 2004-11-26 09:43:22 | 显示全部楼层
楼上的两位兄弟应该都是因为前面的binutils没有装好可能吧。
因为使用lfs这个用户的执行目录是先/tools/bin然后再是主系统的目录,所以当/tools/bin目录已经有的程序会优先于主系统中的使用。
你用ldd /tools/bin/* 看看是不是有连接库有问题呢?
发表于 2004-11-26 11:23:18 | 显示全部楼层
lfs:/mnt/lfs/sources/gcc-build$ ../gcc-3.3.1/configure --prefix=/tools \ > --with-local-prefix=/tools \
> --disable-nls --enable-shared \
> --enable-languages=c
Configuring for a i686-pc-linux-gnu host.
Created "Makefile" in /mnt/lfs/sources/gcc-build using "mt-frag"
/tools/bin/ld: unrecognized option '--as-needed'
/tools/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status
*** The command 'gcc -o conftest -g -O2   conftest.c' failed.
*** You must set the environment variable CC to a working compiler
发表于 2004-11-26 13:04:26 | 显示全部楼层
ldd /tools/bin/*

result:

/tools/bin/ld:
        linux-gate.so.1 =>  (0x002e3000)
        libbfd-2.15.90.0.3.so => /usr/lib/libbfd-2.15.90.0.3.so (0x0086f000)
        libdl.so.2 => /lib/libdl.so.2 (0x00869000)
        libc.so.6 => /lib/tls/libc.so.6 (0x0074c000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00733000)

the other bin files result are all "not a dynamic executable"
发表于 2004-11-26 13:05:42 | 显示全部楼层
/tools/bin/ld  是我从 /bin cp来的 看来还真是不行啊
发表于 2004-11-26 14:11:28 | 显示全部楼层
重复出现  datou1301
提到的错误 如何解决?
发表于 2004-11-26 16:24:31 | 显示全部楼层
有没有重新安装binutils呢?
发表于 2004-11-26 17:14:26 | 显示全部楼层
回版主
又重新从头来了一次 还是同样的问题
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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