TinyCC/tinycc logo

TinyCC/tinycc

Free

Unofficial mirror of mob development branch

FreeFree tier
Type
Open Source

About TinyCC/tinycc

Tiny C Compiler (TCC) is a small, fast ANSI C compiler that can compile and execute C code directly, supporting C scripting via a shebang line. It generates machine code for i386, x86_64, ARM, AArch64, and RISC-V architectures, and compiles about 10 times faster than gcc -O0. TCC includes an optional memory and bound checker for safety, allows direct use of any C dynamic library, and can compile itself. It is designed for scenarios where a minimal C compiler is needed, such as on rescue disks.

Key Features

Very small footprint; usable on rescue disks or embedded systems
Fast compilation and linking, approximately 10x faster than gcc -O0
Generates machine code for i386, x86_64, ARM, AArch64, and RISC-V
Optional memory and bound checker for runtime safety
Directly compile and execute C source without separate linking
Supports C scripting via shebang line (#!/usr/local/bin/tcc -run)
Full C preprocessor included
Can compile itself (self-hosting)
Compatible with any C dynamic library
Heading toward full ISOC99 compliance

Pros & Cons

Pros
  • Extremely small size (easy to bundle or use on minimal systems)
  • Very fast compilation speeds, ideal for rapid prototyping
  • Supports multiple CPU architectures
  • Optional bound checking improves memory safety
  • C scripting makes it easy to run C code without build toolchain
  • Open source and free (MIT-style license)
Cons
  • Not fully compliant with modern C standards (targets ISOC99)
  • Runtime performance may be slower than optimized compilers like gcc -O2
  • Limited tooling and ecosystem compared to GCC or Clang
  • Documentation is minimal; mostly relies on README and examples

Best For

C scripting: run C programs directly like shell scriptsQuick compilation and testing of small C programsUsing C code on resource-constrained systems or rescue disksEducational purposes to learn C compilation internalsEmbedding a lightweight C compiler in other applicationsReplacing gcc for rapid development iterations

FAQ

How do I install TCC on Linux or macOS?
Run ./configure, then make, then make install (use gmake on BSD systems). TCC will be installed to /usr/local/bin by default.
Can I run C code as a script?
Yes, add '#!/usr/local/bin/tcc -run' as the first line of your C source file, make it executable, and run it directly.
What architectures does TCC support?
TCC generates machine code for i386, x86_64, ARM, AArch64, and RISC-V.
Does TCC include a memory checker?
Yes, TCC includes an optional memory and bound checker. Bound checked code can be mixed freely with standard code.
Is TCC compatible with standard C libraries?
Yes, any C dynamic library can be used directly with TCC. It also provides a minimal libc header (tcclib.h) for small systems.