🚀️ GCC cross-compiler toolchain targeting older glibc versions and musl - just download and use it.
⭐ If you find this repository useful, please consider giving it a star.
The toolchain designed for cross-compilation of portable Linux binaries across a wide range of distributions. Intended for use inside a Docker container running Ubuntu 26.04 or later. This toolchain is built using Crosstool-NG.
To get started, download a precompiled toolchain or build from source.
- Modern alternative to old distros. The usual method for producing portable Linux binaries is to compile them on an outdated distribution (e.g., CentOS 7). This toolchain lets you build on a modern system while targeting older environments.
- glibc compatibility. The toolchain is configured to target an older glibc, ensuring compatibility and preventing
errors like:
/lib64/libc.so.6: version GLIBC_2.XX not found. - musl for fully static binaries. The toolchain provides musl targets that produce fully static binaries with no dynamic library dependencies, maximizing portability across any Linux system.
- No build required. The toolchain is ready to download and use immediately. Building GCC from source takes hours; this skips that entirely.
| Target | GCC | C Library | Binutils | GDB | OpenMP |
|---|---|---|---|---|---|
| x86_64-linux-gnu | 16.1.0 | glibc 2.17 | 2.46.1 | 17.2 | 202111 |
| x86_64-linux-musl | 16.1.0 | musl 1.2.6 | 2.46.1 | 17.2 | 202111 |
| aarch64-linux-gnu | 16.1.0 | glibc 2.26 | 2.46.1 | 17.2 | 202111 |
| aarch64-linux-musl | 16.1.0 | musl 1.2.6 | 2.46.1 | 17.2 | 202111 |
| arm-linux-gnueabi | 16.1.0 | glibc 2.26 | 2.46.1 | 17.2 | 202111 |
| riscv64-linux-gnu | 16.1.0 | glibc 2.30 | 2.46.1 | 17.2 | 202111 |
If you prefer not to build the toolchain yourself, a precompiled GCC toolchain for each supported architecture can be downloaded from the releases page.
Replace <target> with one of: x86_64-linux-gnu, x86_64-linux-musl, aarch64-linux-gnu, aarch64-linux-musl,
arm-linux-gnueabi, riscv64-linux-gnu.
The command installs toolchain to /opt. Replace it with a different path if needed.
curl -sSL https://github.com/prepkg/gcc-toolchain/releases/latest/download/gcc-<target>.tar.gz | sudo tar xz -C /optFor example:
curl -sSL https://github.com/prepkg/gcc-toolchain/releases/latest/download/gcc-x86_64-linux-gnu.tar.gz | sudo tar xz -C /opt- Clone the repository:
git clone https://github.com/prepkg/gcc-toolchain.git && cd gcc-toolchain- Build the Docker image:
./setup.sh build-image- Build the GCC toolchain (all targets):
./setup.sh build-toolchainAfter compilation, the toolchains for each architecture will be available in the build directory.
- (Optional) Check the toolchain component versions:
./setup.sh version