Installing gcc on linux without c compiler

前端 未结 5 1687
轻奢々
轻奢々 2021-01-04 02:20

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.

相关标签:
5条回答
  • 2021-01-04 02:51

    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?

    0 讨论(0)
  • 2021-01-04 02:51

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

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

    0 讨论(0)
  • 2021-01-04 02:54

    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.

    0 讨论(0)
  • 2021-01-04 02:55

    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.

    0 讨论(0)
  • 2021-01-04 02:59

    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.

    0 讨论(0)
提交回复
热议问题