GCC 突然停止工作

GCC stops working all of a sudden

我突然注意到,gcc 拒绝编译许多项目。我尝试编译 linux 3.18-rc2 和 eglibc,但两次 GCC 都发出大量错误列表。它似乎首先无法识别的是:

extern __pid_t fork (void) __THROWNL;

它抱怨的内容:

In file included from scripts/basic/fixdep.c:109:0:
/usr/include/unistd.h: In function ‘fork’:
/usr/include/unistd.h:756:28: error: expected declaration specifiers before ‘__THROWNL’
/usr/include/unistd.h:764:16: error: storage class specified for parameter ‘vfork’
/usr/include/unistd.h:770:14: error: storage class specified for parameter ‘ttyname’
/usr/include/unistd.h:774:12: error: storage class specified for parameter ‘ttyname_r’
/usr/include/unistd.h:779:12: error: storage class specified for parameter ‘isatty’
/usr/include/unistd.h:785:12: error: storage class specified for parameter ‘ttyslot’
/usr/include/unistd.h:790:12: error: storage class specified for parameter ‘link’ 
/usr/include/unistd.h:796:12: error: storage class specified for parameter ‘linkat’
/usr/include/unistd.h:803:12: error: storage class specified for parameter ‘symlink’
/usr/include/unistd.h:809:16: error: storage class specified for parameter ‘readlink’ 
/usr/include/unistd.h:816:12: error: storage class specified for parameter ‘symlinkat’
/usr/include/unistd.h:820:16: error: storage class specified for parameter ‘readlinkat’ 
/usr/include/unistd.h:826:12: error: storage class specified for parameter ‘unlink’
/usr/include/unistd.h:830:12: error: storage class specified for parameter ‘unlinkat’
/usr/include/unistd.h:835:12: error: storage class specified for parameter ‘rmdir’
/usr/include/unistd.h:839:16: error: storage class specified for parameter ‘tcgetpgrp’
/usr/include/unistd.h:842:12: error: storage class specified for parameter ‘tcsetpgrp’
/usr/include/unistd.h:849:14: error: storage class specified for parameter ‘getlogin’
/usr/include/unistd.h:857:12: error: storage class specified for parameter ‘getlogin_r’
/usr/include/unistd.h:862:12: error: storage class specified for parameter ‘setlogin’

我尝试了“HOSTCC='gcc -std=gnu99',认为它可能无法识别代码中的许多 GNU 扩展,结果是一样的。编译一个简单的 C 程序确实有效:

$ echo "int main (void) {return 0;}" > silly.c && gcc -o silly silly.c
$ 

可能出了什么问题?

编辑:这是根据自身的 GCC 版本

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-5) 

原来我的 /usr/include 文件夹损坏了。没关系,问题解决了。

感谢大家。

我是怎么想的:我试图交叉构建 EGLIBC,不小心安装了 /usr/include 中的头文件。我一定是损坏了什么东西。