Supported architectures
TinyCC can cross-compile for the following target architectures:- i386 - 32-bit x86 (Linux, Windows)
- x86_64 - 64-bit x86 (Linux, Windows, macOS)
- ARM - 32-bit ARM (Linux, Windows CE)
- ARM64 - 64-bit ARM/AArch64 (Linux, macOS, BSD)
- RISC-V 64 - 64-bit RISC-V (Linux)
Cross-compilation support varies by host platform. Not all target architectures can be built from all host systems.
Building cross-compilers
1
Enable cross-compilation during configuration
When configuring TinyCC, enable cross-compiler builds:This enables building all supported cross-compilers.
2
Build all cross-compilers
Build all cross-compilers and their runtime libraries:This creates executables like
i386-tcc, x86_64-tcc, arm-tcc, arm64-tcc, and riscv64-tcc.3
Build specific cross-compiler (optional)
To build only a specific cross-compiler:
4
Install cross-compilers
Install the cross-compilers to your system:
Using cross-compilers
Basic cross-compilation
Use the architecture-specific TCC binary to cross-compile:Target-specific switches
Platform-specific targets
Windows (PE) executables
Cross-compile Windows executables from Linux:macOS (Mach-O) executables
Cross-compile macOS binaries:ARM platforms
Configuration options
System root and include paths
Specify custom system root and library paths for cross-compilation:Triplet configuration
Set the target triplet for library and include directory detection:Runtime library (libtcc1.a)
Each cross-compiler requires its own runtime library:- Integer division and modulo operations
- 64-bit integer operations on 32-bit platforms
- Floating-point operations
- Memory operations (memset, memcpy)
Limitations
Advanced cross-compilation
Custom cross-compiler configuration
Createconfig-extra.mak to customize cross-compiler paths:
Multiple target builds
Build for multiple targets in sequence:Troubleshooting
Missing headers or libraries
If cross-compilation fails due to missing headers:Testing cross-compiled binaries
Test cross-compiled binaries using QEMU:See also
- Configuration - Build configuration and customization
- Debugging - Debug cross-compiled binaries
- Quickstart - Getting started with TinyCC