Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

As an example:

hsmyers@ubuntu:~/c_dev$ cat hello.c
#include <stdio.h>

int main(int argc,char **argv) {
printf("Hello World!\n");
return 0;
}
hsmyers@ubuntu:~/c_dev$ gcc -c -o hello.o hello.c
In file included from /usr/include/stdio.h:28:0,
             from hello.c:1:
/usr/include/features.h:323:26: fatal error: bits/predefs.h: No such file or directory
compilation terminated.

At a guess somewhere along the way after trying to fix the error message:

/usr/bin/ld: cannot find crt1.o: No such file or directory

I've munged things up completely. Could anyone please advise?

share|improve this question
    
Do you already have libc-dev installed? It compiles fine for me. –  itnet7 Nov 25 '11 at 5:22
add comment

3 Answers

You need to install gcc-multilib package that brings 32bit specific headers to your 64bit operation system.

share|improve this answer
add comment

This works fine for me, on a fresh oneiric install. /usr/include/x86_64-linux-gnu/bits/predefs.h is provided by the libc6-dev package, perhaps that is not installed correctly?

You can "reinstall" that package with:

sudo apt-get install --reinstall libc6-dev

However, if that file is present, then it looks like your compiler's search path isn't looking in the right place for that file. You can check by running the following:

gcc --verbose -o hello hello.c

which should print the search path for include files. Mine says:

    #include <...> search starts here:
     /usr/lib/gcc/x86_64-linux-gnu/4.6.1/include
     /usr/local/include
     /usr/lib/gcc/x86_64-linux-gnu/4.6.1/include-fixed
     /usr/include/x86_64-linux-gnu
     /usr/include

If that's not the same, I'd say there is a version mismatch between some of your build-essential packages. Check that you have the right versions of the gcc, and libc6-dev packages. Right now on oneiric, these should be:

gcc           4:4.6.1-2ubuntu5
libc6-dev     2.13-20ubuntu5 
share|improve this answer
    
result of the --verbose attempt are: –  hsmyers Nov 25 '11 at 16:14
    
How do I reply to an answer? Minimally, my version of GCC is 4.7.0 listed as experimental. I've no idea how it got installed. In so far as I can tell, libc6-dev is installed. My include paths are similar to: /usr/local/lib/gcc/i686-pc-linux-gnu/4.7.0/include (also /include-fixed) with the standard /usr/local/include as well. I can not find either bits as a directory or bits/predefs.h within it. I will try the reinstall and see what happens. –  hsmyers Nov 25 '11 at 16:26
    
Reinstall made no difference. Found bits at /usr/include/i386-linux-gnu/bits, not shown as part of GCC include paths. My version of libc6-dev matches yours. –  hsmyers Nov 25 '11 at 16:52
    
I'd suggest that the experimental (and non-Ubuntu-standard) version of gcc is your problem. I'd suggest removing that and installing 4.6.1 from the archive. –  Jeremy Kerr Nov 25 '11 at 21:42
    
Pretty much what I was thinking---excepting the small problem of not knowing a) how it got there and b) how to remove it. Will an apt-get remove gcc work? Or will I need the complete package name? Perhaps i686-pc-linux-gnu-4.7.0 ? –  hsmyers Nov 25 '11 at 23:44
show 9 more comments

I had the same problem with my avr-gcc compiler.

I linked the files and folders in /usr/include/i386-linux-gnu/ to a folder in which avr-gcc searches for -files. For Example: /usr/lib/avr/include/

ln -s /usr/include/i386-linux-gnu/* /usr/lib/avr/include/

Maybe something similar works for gcc. To

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.