免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4241 | 回复: 1
打印 上一主题 下一主题

菜鸟请教一个关于gcc编译时遇到的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-08-04 15:33 |只看该作者 |倒序浏览
本人初学Linux,遇到一个问题,用gcc-3.4.6编译编译apr,执行configure时报错了,错误信息如下:

......
configure:4802: $? = 0
configure:4809: gcc -v >&5
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.6/specs
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-11)
configure:4813: $? = 0
configure:4820: gcc -V >&5
gcc: `-V' option must have argument
configure:4824: $? = 1
configure:4847: checking for C compiler default output file name
configure:4869: gcc conftest.c >&5
configure:4873: $? = 0
configure:4911: result: a.out
configure:4930: checking whether the C compiler works
configure:4940: ./a.out
configure:4944: $? = 0
configure:4963: result: yes
configure:4970: checking whether we are cross compiling
configure:4972: result: no
configure:4975: checking for suffix of executables
configure:4982: gcc -o conftest conftest.c >&5
configure:5077: checking whether we are using the GNU C compiler
configure:5106: gcc -c conftest.c >&5
configure:5113: $? = 0
configure:5130: result: yes
configure:5139: checking whether gcc accepts -g
configure:5169: gcc -c -g conftest.c >&5
configure:5176: $? = 0
configure:5277: result: yes
configure:5294: checking for gcc option to accept ISO C89
configure:5368: gcc -c -g -O2 conftest.c >&5
conftest.c:8:20: error: stdarg.h: No such file or directory
In file included from conftest.c:9:
/usr/include/stdio.h:34:21: error: stddef.h: No such file or directory
In file included from /usr/include/_G_config.h:44,
from /usr/include/libio.h:32,
from /usr/include/stdio.h:72,
from conftest.c:9:
/usr/include/gconv.h:72: error: expected declaration specifiers or '...' before 'size_t'
/usr/include/gconv.h:88: error: expected declaration specifiers or '...' before 'size_t'
/usr/include/gconv.h:97: error: expected declaration specifiers or '...' before 'size_t'
/usr/include/gconv.h:174: error: expected specifier-qualifier-list before 'size_t'
......


我查了下这两个文件,发现系统里面有:
find / -name stdarg.h
/usr/lib/gcc/i386-redhat-linux/3.4.3/include/stdarg.h
/usr/lib/syslinux/com32/include/stdarg.h
/home/download/gcc-4.5.1/gcc/ginclude/stdarg.h
/home/download/gcc-4.5.1/fixincludes/tests/base/stdarg.h
/home/download/gcc-4.5.1/libstdc++-v3/include/c_compatibility/stdarg.h
/home/download/gcc-4.5.1/libstdc++-v3/include/tr1/stdarg.h

find / -name stddef.h
/usr/lib/gcc/i386-redhat-linux/3.4.3/include/stddef.h
/usr/lib/syslinux/com32/include/stddef.h
/usr/lib/syslinux/com32/include/bitsize/stddef.h
/usr/include/linux/stddef.h
/home/download/gcc-4.5.1/gcc/ginclude/stddef.h
/home/download/gcc-4.5.1/libstdc++-v3/include/c_compatibility/stddef.h
但是一个是在3.4.3目录里面,download目录下的是我下载的gcc源码,还没编译(编译也会报这个错),我把这些目录加到path里面重新执行configure还是一样 的错误。。。

论坛徽章:
2
摩羯座
日期:2013-10-10 14:29:04天蝎座
日期:2014-01-03 09:14:49
2 [报告]
发表于 2010-08-10 17:44 |只看该作者
> configure:5368: gcc -c -g -O2 conftest.c >&5
> conftest.c:8:20: error: stdarg.h: No such file or directory
> In file included from conftest.c:9:
> /usr/include/stdio.h:34:21: error: stddef.h: No such file or directory

凡是configure时候的错误,如果想了解具体的原因,你都可以手动去执行一下configure中具体的命令。

创建一个conftest.c,然后执行一下gcc -c -g -O2 conftest.c。如果,你可以成功执行,那么问题也就解决了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP