0

I got an offline Ubuntu 20.04. I wanted to use curl, but it wasn't installed. Trying to install it, needs binutils; tried to install binutils, needs make, tried to install make, needs...gcc!

I seriously didn't think it was possible to have an Ubuntu without gcc, but here I am, trying to install gcc offline. I've followed this stackoverflow question; it doesn't gives a lot of indications so I've read the gnu doc. Here I am a bit lost: seems the prerequisite to install gcc include...gcc, and other things that require gcc to be installed. So I left out the prerequisite part and started the configuration part. Here are my step:

  1. Downloaded latest gcc tar.gz file, uploaded it on my ubuntu (with scp), and extracted (in /home/username, keeping the default directory name gcc-12.1.0)
  2. made a new dir: /home/username/objdir (lack of imagination here, just following the doc)
  3. Launch configure from here. According to the doc, it should fail because there's no cc. Indeed, it fails saying there is no cc.
  4. Managed to found a cc in my ubuntu, but not in bin; it's in /lib/gcc/x86_64-linux-gnu/9/cc1. I copy-pasted it in /usr/bin, and renamed it cc instead of cc1. Note that there is nothing else in that /lib/gcc directory, only the cc1 at the end. There is a /lib/cpp executable too, so while I was here I've tried a cpp -v; the result (below) is weird and I don't really understand it (I guess it won't be weird for someone who do understand ^^ ) cpp -v output
  5. Relaunch configure. Now it does find cc, but fails at the "check if we are cross compiling" step. It says "error in /home/username/objdir; error: cannot run C compiled programs".
  6. The doc says if, for some reason, configure fails to guess the configuration, add --host=... to the command and the host and target will default to be the same as the host machine. So I've launched configure --host=x86_64-pc-linux-gnu (pretty much same name as the dir I found in the /lib/gcc dir, also the one configure writes before failing, so should be good). Now the "check if we are cross-compiling" step pass, saying yes, but next step fails: configure result
  7. It says to check config.log for more details, so here I go. It looks to me like it has a hard time finding cc version (like, tries multiple options to get it, but none works) check cc version Then it goes to "checking if the C compiler works", and to my surprise, it says yes check if C compiler works Does other checks that I don't really understand but it seems happy with it other checks And then, there is this cross-compiling check, and I really don't like the output here: Check cross-compiling

As you can see, it says "stdio.h: No such file or directory.". At this point, I'm sick of it and would like to kill the man who installed this Ubuntu without anything; but whatever, following this question I figured I need to install libc6-dev. Now I've been to ubuntu packages, and searched for libc6-dev in my version. There is quite a lot. I have no idea which I should take, no idea if I will be able to install it (dependencies says libgcc), and I'm tired of this.

Is there any (more simple) way to install gcc on an offline ubuntu, or should I continue to walk this (seemingly infinite) path?

Ablia
  • 191
  • 2
  • 10

0 Answers0