18

How can I install gcc on a system that have not any c compiler? this system is a linux base firewall and have not any c compiler.

Majid
  • 13,853
  • 15
  • 77
  • 113
hamSh
  • 1,163
  • 1
  • 13
  • 27
  • 1
    huh? Why do you need a compiler to install things? The basic application you need is `cp`, and maybe `mount`. – Elazar Leibovich Aug 13 '10 at 11:44
  • Elazar: It's possible he needs to compile GCC if he is using a Linux distro that doesn't provide tools for installing. I don't know what "linux base firewall" means though. – Stephen Aug 13 '10 at 11:50
  • If you don't have a compiler installed I will guess there are many other system includes and libraries that aren't installed that you will need for compiling. You can look here for some binaries to help start. http://gcc.gnu.org/install/binaries.html – James Black Aug 13 '10 at 12:01
  • Given that the OP like IanH's answer, this question is marginal for Super User. I'm inclined to leave it here. – dmckee --- ex-moderator kitten Aug 15 '10 at 05:12
  • I think he rooted his "linux-based" firewall and has found that there is no compiler. – Brian Ortiz Aug 23 '10 at 07:16

5 Answers5

17

I guess you a have an appliance running Linux and shell-access, but neither a package manager nor a compiler is installed.

So, you need to cross-compile gcc and the whole toolchain (at least binutils) - this is quite simple, because the ./configure scripts of gcc, binutils, gdb etc. support cross-compiling with the --target= option. So all you have to do is to find out the target architecure (uname helps) and then download, unpack the gcc sources on a linux-host and run ./configure --target=$YOUR_TARGET.

With this, you now can build a cross-compiler gcc - this still runs on your host, but produces binaries for your target (firewall appliances).

This may already be sufficient for you, a typical desktop PC is much faster than a typical appliance, so it may make sense to compile everything you need on the Desktop PC with the cross-compiler and cross-binutils.

But if you really wish to do so, you can now also use your cross-compiler to compile a gcc running on your target (set this as --host= option) and compiling for your target (set this as --target option).

You can find details about allowed host/targets and examples in the gcc documentation: http://gcc.gnu.org/install/specific.html.

IanH
  • 3,968
  • 2
  • 23
  • 26
  • 1
    I've run into exactly this problem - an appliance with Linux(Debian 3.4) and shell-access, but no package manager or compiler. I'd like to install apt-get, but I really don't know where to start. Is there any noob(ish) friendly reading material you could point me to? My Google-Fu is failing me on this one. Any help would be greatly appreciated! – opticon May 17 '13 at 21:11
1

It depends on the distribution, if it's based on debian or some other of the big ones you can install gcc through apt-get or similar tool.

If it's a more basic system you need to compile gcc yourself on another computer and copy it over. It will be easiest if you have another computer with the same architecture (i386, arm or x86_64 for example).

I think that you might want to compile it statically also, so that you don't have dependencies on external libraries.

Alexander Kjäll
  • 4,246
  • 3
  • 33
  • 57
  • this linux system based on EFW (endian fire wall) – hamSh Aug 13 '10 at 11:57
  • 5
    I would maybe also say that i would look over the reasons you have for installing gcc on your firewall, it sounds like a bad idea from start. So only try to go down this path if you have a really good reason to do it. – Alexander Kjäll Aug 13 '10 at 12:46
0

How do you plan to get all the source code needed for GCC loaded onto your machine? Could you mount the ISO image onto this machine and install from there?

Jayan
  • 18,003
  • 15
  • 89
  • 143
0

Since you are using Endian Firewall, see "Building a development box" at the following link:

http://alumnus.caltech.edu/~igormt/endian/tips.html

Justin
  • 8,853
  • 4
  • 42
  • 42
-1

If it's a debian based distribution, you can use

sudo apt-get install gcc

Note: maybe you must change "gcc" by a specific version of the debian package.

Topera
  • 12,223
  • 15
  • 67
  • 104