prepkg / gcc-toolchain

GCC toolchain targeting older glibc versions.

Repository from Github https://github.comprepkg/gcc-toolchainRepository from Github https://github.comprepkg/gcc-toolchain

GCC Toolchain

GCC toolchain targeting older glibc versions, designed for building Linux binaries that run across a wide range of distributions. Intended for use inside a Docker container running Ubuntu 24.04 or later. This toolchain is built using Crosstool-NG.

Why?

The usual method for producing portable Linux binaries is to compile them on an outdated distribution (e.g., CentOS 7).

This repository provides a modern alternative: a GCC toolchain configured to target an older glibc, ensuring compatibility and preventing errors like:

/lib64/libc.so.6: version `GLIBC_2.XX' not found

Supported Toolchains

  • x86_64-linux-gnu:
Component Version
GCC 15.2.0
glibc 2.17
Binutils 2.45
GDB 16.3
  • aarch64-linux-gnu:
Component Version
GCC 15.2.0
glibc 2.17
Binutils 2.29.1
GDB 16.3

Precompiled Toolchains

If you prefer not to build the toolchain yourself, a precompiled GCC toolchain for each supported architecture can be downloaded from the releases page.

  • x86_64-linux-gnu:
curl -sSLo gcc-x86_64-linux-gnu.tar.gz https://github.com/prepkg/gcc-toolchain/releases/latest/download/gcc-x86_64-linux-gnu.tar.gz
  • aarch64-linux-gnu:
curl -sSLo gcc-aarch64-linux-gnu.tar.gz https://github.com/prepkg/gcc-toolchain/releases/latest/download/gcc-aarch64-linux-gnu.tar.gz

Compilation

  • 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:
./setup.sh build-toolchain
  • (Optional) Check the toolchain component versions:
./setup.sh version

After compilation, the toolchains for each architecture will be available in the build directory.

About

GCC toolchain targeting older glibc versions.

License:MIT License


Languages

Language:Shell 84.3%Language:Dockerfile 15.7%