Search code examples
c++clinuxgcczynq

How install gcc on Linux without compiler


I have a very light Linux OS that does not have any compiler on it. How can I install gcc or g++ on it? The target hardware is an armv7-a processor. Can I compile gcc on my x86 system and then install it on my armv7 Linux??


Solution

  • Yes, you can compile your code on your x86 device and then export it to your arm device. But for this, you need a special compiler. This process is called "cross-compilation", where you compile a code for a special target device on an other device.

    For arm devices, the one I used was the "arm-linux-gnueabihf-gcc" compiler.

    Once installed, you can use it just like your casual gcc compiler. For example, on linux, it would be something like this :

    $ arm-linux-gnueabihf-gcc -o your_program your_program.c

    You then export the compiled output to your device, and it should work.