2

I'm attempting to build GCC from source on a RHEL6 virtual machine, and have run into a Catch 22. That is, I need a C compiler for successful configuration. The solution seems simple enough - execute yum to solve dependencies. However, this virtual machine cannot have an Internet connection.

Does anybody have any sources for a binary or .rpm containing a pre-compiled compiler, simplifying installation? I've searched, but cannot find one. Alternatively, does a RHEL6 command exist to install a pre-compiled version of GCC? If neither are possible, what C compilers might I pursue to resolve this?

For context, here's the message I receive:

../gcc-4.7.2/configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for gawk... gawk
checking for libitm support... yes
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/gcc/gcc-build':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
Matt
  • 41
  • 2
  • 6

2 Answers2

2

It is not possible to compile gcc source code without any C compiler installed on your VM.

If you can transform files from your host to VM, then you have two ways:

  1. Compile the source code on your host and copy them to your VM. Use ./configure --prefix=/<path>/<to>/<output> to specify the output directory. If your VM CPU arch is different from your host, you may want to look at cross compile.

  2. Download gcc rpm package from a Redhat's rpm repository mirror. Search it in google and you will get an answer.

But it is always a good idea to use yum or rpm to install software in RHEL. I have some questions about your problem:

  1. Why you don't have gcc installed on your RHEL6? It is installed by default.
  2. What VM are you using? The best solution of your problem may be figuring out a way to get network available in your VM.
Bin Wang
  • 2,697
  • 2
  • 24
  • 34
0

Since you don't have Internet access on your VM, you probably won't be able to use the dependency resolving yum or rpm. I'll assume you don't want to connect or can't connect the VM to the internet.

From an Internet connected system, you can download a self-contained pre-built version of GCC and the rest of the toolchain here:

The IA32 GNU/Linux native compiler is here:

You will still need to find a way to get the installer onto your VM.