This GitHub action sets up GCC in your workflow run.
- Installs either 32-bit or 64-bit GCC on Ubuntu (possibly, a specific version).
- Specify a version to install using the
versionparameter. - For installing GCC on Windows please see my action setup-mingw.
Use it in your workflow like this:
- name: Set up GCC
uses: egor-tensin/setup-gcc@v2
with:
version: latest
platform: x64
latestis the default value for theversionparameter and can be omitted.x64is the default value for theplatformparameter and can be omitted. Usex86if you want to build 32-bit binaries.ccandc++executables are set up, pointing to thegccandg++executables. Disable this by setting theccparameter to0.
| Input | Value | Default | Description |
|---|---|---|---|
| version | latest | ✓ | Install the latest version available in the repository. |
| any | Install a specific version if it's available (see below). | ||
| platform | x64 | ✓ | Install the x86_64 toolchain. |
| any | Install the i686 toolchain. | ||
| cc | 1 | ✓ | Set up cc/gcc/c++/g++ executables. |
| any | Don't set up the executables. |
Unless the version parameter value is "latest", the ubuntu-toolchain-r/test
PPA is used to make more versions available.
You can pass the version number as the version parameter value (4.8, 8,
9, etc.), and this action will install the corresponding packages.
The version parameter value is not checked for being an available version for
the current distribution.
The supported versions for a particular distribution are those found in that
distro's repositories & those in the PPA.
For example, you can find the list of available versions as of December 2025
below.
version |
Jammy | Noble |
|---|---|---|
| 9 | ✓ | ✓ |
| 10 | ✓ | ✓ |
| 11 | ✓ | ✓ |
| 12 | ✓ | ✓ |
| 13 | ✓ | ✓ |
| 14 | ✓ |
This table should be updated periodically; it's a work-in-progress. (Note to self: the list of available GCC versions can be found here and in the PPA repo.)
Distributed under the MIT License. See LICENSE.txt for details.