LinuxSir.cn,穿越时空的Linuxsir!

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

我的gcc确认编译报错,帮忙看看!!

[复制链接]
发表于 2005-4-15 15:37:16 | 显示全部楼层 |阅读模式
[root@redhat9 xine-lib-1-rc6a]# ./configure
checking build system type... i686-pc-linux-gnuoldld
checking host system type... i686-pc-linux-gnuoldld
checking target system type... i686-pc-linux-gnuoldld
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.
不管编译确认什么,都是提示error: C compiler cannot create executables错误,我用gcc -v查看结果是:[root@redhat9 xine-lib-1-rc6a]# gcc -v
Reading specs from /usr/lib/gcc-lib/i386-glibc21-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
系统是redhat 9的,照理说rh9的gcc应该是3.2.2-5的,到底问题在哪里,本来想装个新的gcc,可以编译确认的时候报错,现在是装什么程序都失败,懂的人帮忙看看,问题在哪里,谢谢。
发表于 2005-4-15 19:12:04 | 显示全部楼层
自己写一个C程序试试看gcc能不能编译:
$echo 'int main() { printf("hello, world!"); putchar(10);return 0; }' > hello.c
$gcc -o hello hello.c
$./hello
hello, world!

如果以上成功了,可能是configure找gcc时,路径不对。试试自已给configure一个路径:
$./configure CC=/usr/bin/gcc

祝好运!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-4-17 20:55:39 | 显示全部楼层
[hlf@redhat9 yule]$ gcc -o hello hello.c
collect2: cannot find `ld'
没有成功。。。。
回复 支持 反对

使用道具 举报

发表于 2005-4-18 08:44:36 | 显示全部楼层
是不是开发工具没有装?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-4-18 14:16:05 | 显示全部楼层
我已经在开发的开发工具里边都选上了。还有哪些开发工具没有装,是devel的吗?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-4-19 20:53:29 | 显示全部楼层
我又把gcc卸载了重新安装,用gcc -v的显示正确:[hlf@redhat9 hlf]$ gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
但是编译hello.c的时候还是报collect2: cannot find `ld'
这个错误,是链接错误还是什么?
回复 支持 反对

使用道具 举报

发表于 2005-4-20 08:42:32 | 显示全部楼层
ld是一个链接程序。它可以把你的编译生成的目标文件和库文件链接起来。
在你的错误提示里说,没有找到ld,那可能是ld没有装。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-4-20 21:39:03 | 显示全部楼层
说的没有错,是ld的问题,是我之前装oracle的时候把ld保存到别的目录去了,现在把它考回来就好了。。。兜了一个打圈原来就是因为装oracle的 时候有些软件备份到别的目录,呵呵现在总算弄清楚了。
回复 支持 反对

使用道具 举报

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

本版积分规则

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