How do I compile something for Linux if I don't have enough space for installing GCC?

Usually, for an embedded device, one doesn't compile software directly on it. It's more comfortable to do what is called cross-compilation which is, in short, compiling using your regular PC to another architecture than x86.

You said you're new to Linux; just for your information, you're facing a huge problem: cross-compiling to embedded devices is not an easy job.

I researched your HMI system and noticed some results that are talking about Yocto. Yocto is, in short, a whole framework to build firmware for embedded devices.

Since your HMI massively uses Open Source projects (Linux, probably busybox, etc.) the manufacturer must provide you a way to rebuild all the open source components by yourself. Usually, what you need to do that is the BSP (Board Support Package). Hardware manufacturer usually ship it:

  • Using buildroot project that allows you to rebuild your whole firmware from scratch.
  • Using yocto meta that, added to a fresh copy of the corresponding yocto project, will allow you to rebuild your whole firmware too.
  • More rarely, a bunch of crappy scripts and pre-built compiler.

So, if I was you, I would:

  1. Contact the manufacturer support to ask for the stuff to rebuild the firmware as implied by the use of Open Source.
  2. In parallel, search Google for "your HMI + yocto", "your HMI + buildroot", etc.

After Googling even more, I found out a Yocto meta on github.

You can check the machines implemented by this meta upon the directory conf/machine of the meta.

There's currently five machines defined under the following codenames:

  • us01-kit
  • us02-kit
  • us03-kit
  • usom01
  • usom02

So I suggest that you dig into this. This is probably the way you can build software by yourself. You can also check this page on the github account that may give you some more clues.


I agree with binarym's answer regarding cross-compiling. However, if one still wanted to compile directly on a machine with such conservative hardware, I would recommend taking a look at smaller compiler such as the Tiny C Compiler (tcc) which takes up approximately 100KB on x86 architecture. I will point out, however, that it extends support only up to ISO C99, not C11.