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.
GCC stands for GNU Compiler Collections which is used to compile mainly C and C++ language. It can also be used to compile Objective C and Objective C++.
so can a linux distribution work perfectly without a c compiler? In general, yes. There are (or were) closed source programs though which are very low level and thus need to adapt to the kernel version by compiling some glue code.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With