菜鸟请教一个关于gcc编译时遇到的问题

发布于 2022-09-07 00:17:53 字数 3138 浏览 18 评论 1

本人初学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还是一样 的错误。。。

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

各自安好 2022-09-15 00:22:02

> 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。如果,你可以成功执行,那么问题也就解决了。

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文