gcc no longer works after upgrade

15,071

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

Share:
15,071

Related videos on Youtube

hsmyers
Author by

hsmyers

Started hacking in 1975. Haven't stopped. Currently happiest in Perl, Lisp and C/C++. Have done well writing interfaces for chess engines. Use chess as a way to learn a new (to me) language. Least I forget (and I did :) ) I started TeX-ing after returning from the 2nd West Coast Computer Faire. I spent a fair amount of time talking to a fellow hacker who was porting TeX to an 8-bit environment. Don't remember if he succeeded or not (memory may not be the first to go, but go it does) but I do remember that I owned a PDP-11/23 at that time and I believe that DECUS had a usable version. Primary problem was that this was a bit before the arrival of either Laser Printers or Postscript. But once all of the necessary ingredients were put together I fell into the land of good looking documents. I have to say that it helped that my Father-In-Law owned and used two Franklin printing presses and was kind enough to let me play---good old days indeed.

Updated on September 18, 2022

Comments

  • hsmyers
    hsmyers almost 2 years

    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?

    • itnet7
      itnet7 over 12 years
      Do you already have libc-dev installed? It compiles fine for me.
  • hsmyers
    hsmyers over 12 years
    result of the --verbose attempt are:
  • hsmyers
    hsmyers over 12 years
    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
    hsmyers over 12 years
    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.
  • Jeremy Kerr
    Jeremy Kerr over 12 years
    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.
  • hsmyers
    hsmyers over 12 years
    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 ?
  • ams
    ams over 12 years
    The missing crti.o message is caused by trying to use a non-multiarch-aware compiler with a multiarch distro (as Ubuntu now is). I'd imagine you got the new compiler from a PPA, although those normally get removed during the upgrade process. Check your software sources - if that's not it, check your path (type gcc) - maybe you have a gcc-4.7 snapshot install in /usr/local?
  • hsmyers
    hsmyers over 12 years
    type gcc shows /usr/local/bin/gcc I'm still un-sure of how to go about getting a clean install of 4.6.1 although If I knew how to get rid of 4.7.0 I'd be a largish step in the right direction...
  • Jeremy Kerr
    Jeremy Kerr over 12 years
    You can check which package that file belongs to with dpkg -S /usr/local/bin/gcc. Just apt-get remove that package.
  • hsmyers
    hsmyers over 12 years
    If I do: dpkg -S /usr/local/bin/gcc I get: hsmyers@ubuntu:~/c_dev$ dpkg -S /usr/local/bin/gcc dpkg-query: no path found matching pattern /usr/local/bin/gcc. If I switch to /usr/local/bin and do: dpkg -S gcc the result is 209 lines of text without a single reference to 4.7---all 4.5 and 4.6. Color me still confused. Thanks for the ongoing help on this shipwreck by the way...
  • hsmyers
    hsmyers over 12 years
    Don't know if this is progress or not, but am back to "cannot find crt1.o" with no mention of missing includes. Running dpkg -l gcc says that everything is 'un' excepting some non removable items like gcc-4.6-base. Even with all apparent gccs removed, gcc --version still reports 4.7.0 and I've no idea of where it resides.
  • hsmyers
    hsmyers over 12 years
    My 4.7 is indeed located in /usr/local/bin and while I have numerous crt1.o-s, I'm fairly sure none of them are compatible with 4.7. Suggestions? (Kudos to ams for accuracy!)
  • Jeremy Kerr
    Jeremy Kerr over 12 years
    So I'd suggest removing 4.7. Since it doesn't belong to a package, you must have installed it through other means. If there's nothing else important under /usr/local, you could just remove /usr/local/*, but check carefully first.
  • hsmyers
    hsmyers over 12 years
    Looks as though that might be a problem---there are 7685 files in that particular tree and only a portion are 4.7 related. I think I'll try and remove the binaries and then install 4.6, cross my fingers and see what happens.
  • hsmyers
    hsmyers over 12 years
    While there is still some clean up I can do, the binaries for 4.7 are now history. I've done a minimal install of 4.6 using apt-get and every thing now seems to work. The only hangup I noticed was that I was expecting gcc --version to work, but the install made no provision for the shorthand name. gcc-4.6 --version worked fine and a simple alias adds gcc easily. So to everyone who helped; Jeremy Kerr and ams much thanks! Couldn't have made it without you. Learned a great deal. BTW Jeremy are you any relation to the Kerr family out of Texas?