0

Is there a smaller download for GCC if the only language you need to be compiled is C? TCC is a fantastic option for windows, however I need it to compile on several platforms. I also like the fact that GCC is very commonly used.

If there is not a specific download that is smaller, would I be able to weed out the data in the downloaded package that is not needed to compile C? Would there be issues to this approach?

Braden Steffaniak
  • 2,053
  • 3
  • 25
  • 37
  • Are you looking to compile GCC from source code? Or are you looking to install GCC via your OS's package manager? – Jonathon Reinhart Apr 21 '14 at 22:33
  • Why do you care? You're not running the compiler on an embedded device (with constrained memory), are you? – Robert Harvey Apr 21 '14 at 22:33
  • 3
    Who said GCC is standard? – xis Apr 21 '14 at 22:35
  • How small do you want it to be? Is it the size of the installer you care about, or the size of the installed tools, headers and libraries? – Michael Burr Apr 21 '14 at 22:36
  • 1
    On a system based on Debian, this would simply be `apt-get install gcc`. That would install only the C frontend, headers, and runtime library, and not the bits for C++, Objective-C, Fortran, Ada, Go, or Java. – Phil Miller Apr 21 '14 at 22:40
  • @MichaelBurr I would like to distribute it with a product, so both if possible. The smaller the better. – Braden Steffaniak Apr 21 '14 at 22:41
  • @XiaogeSu Sorry, how about "very common." – Braden Steffaniak Apr 21 '14 at 22:43
  • @RobertHarvey I may in the future. – Braden Steffaniak Apr 21 '14 at 22:43
  • @BradenSteffaniak You didn't answer my question. However, this has to do with how you *configure* GCC when you build it (if you are building it from source). – Jonathon Reinhart Apr 21 '14 at 22:45
  • 1
    I don't think that's wise. I think you ought to use a real computer to compile your embedded programs. Embedded devices are too memory constrained to do this effectively. If you insist, there are tools like the Tiny C Compiler you might be able to use, but GCC is unsuitable for this purpose. – Robert Harvey Apr 21 '14 at 22:45
  • @RobertHarvey I have looked at TCC (as stated in the question) and it only compiles an executable for Windows. (It can run interpreted on some other platforms) Either way, the smaller the better. I don't like the idea of having a 1GB dependency. – Braden Steffaniak Apr 21 '14 at 22:47
  • llvm and clang can be compiled into a library that can be used inside your product, if you like to. It makes around 100MB for just the compiler (you may also need some library files, etc). – Mats Petersson Apr 21 '14 at 22:59

1 Answers1

5

When you build GCC, you must first configure it.

Specifying --enable-languages=c will constrain your build to only the C language.

There are many other options that allow you to tailor GCC to your needs.

Jonathon Reinhart
  • 132,704
  • 33
  • 254
  • 328