Reputation: 985
I noticed that all of a sudden, gcc refuses to compile many of the projects. I tried to compile linux 3.18-rc2 and eglibc, but both of the times GCC emits an enormous list of errors. It seems the very first thing it fails to recognise is this:
extern __pid_t fork (void) __THROWNL;
about which it complains:
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’
I tried "HOSTCC='gcc -std=gnu99' instead, thinking that maybe it doesn't recognise many of the GNU extensions in the code, and the result was the same. Compiling a trivial C program does work:
$ echo "int main (void) {return 0;}" > silly.c && gcc -o silly silly.c
$
What could have gone wrong?
EDIT: this is the version of GCC according to itself
$ 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)
Upvotes: 0
Views: 540
Reputation: 985
It turns out I've corrupted my /usr/include folder. Nevermind, problem's gone.
Thanks to all.
How I think it happened: I was trying to cross-build EGLIBC and accidentally installed the header files in /usr/include. I must've corrupted something.
Upvotes: 2