gcc

C and C++ compilers (gcc and gcc-c++) for the host.

For most development work, use a container (toolbox, distrobox, etc.) instead, since building software usually also needs headers and -devel packages that are not available on an image-based host.

This sysext is for tools that run directly on the host, need a compiler, and do not work well from inside a container. For example:

  • Homebrew needs a host compiler to build formulae from source and for some of its own setup.
  • nvim-treesitter compiles parsers with the compiler available to Neovim. With a host Neovim (for example from the neovim sysext), this happens on the host, both for explicit installs and updates and, in many configs, automatically the first time a new file type is opened.

Compatibility

This sysext is compatible with all Fedora variants (CoreOS, Atomic Desktops, etc.).

Versions available

See the gcc versions.

Usage instructions

First time setup

Run those commands if you have not yet installed any sysext on your system:

sudo install -d -m 0755 -o 0 -g 0 "/var/lib/extensions" "/var/lib/extensions.d"
sudo restorecon -RFv "/var/lib/extensions" "/var/lib/extensions.d"
sudo systemctl enable --now systemd-sysext.service
Installation

Define a helper function:

install_sysext() {
  SYSEXT="${1}"
  URL="https://extensions.fcos.fr/fedora"
  sudo install -d -m 0755 -o 0 -g 0 "/etc/sysupdate.${SYSEXT}.d"
  sudo restorecon -RFv "/etc/sysupdate.${SYSEXT}.d"
  curl --silent --fail --location "${URL}/${SYSEXT}.conf" \
    | sudo tee "/etc/sysupdate.${SYSEXT}.d/${SYSEXT}.transfer"
  sudo /usr/lib/systemd/systemd-sysupdate update --component "${SYSEXT}"
}

Install the sysext:

install_sysext gcc

Reboot your system or refresh the merged sysexts:

sudo systemctl restart systemd-sysext.service
systemd-sysext status

Note that this will merge all installed sysexts unconditionally.

Updates

Update this sysext using:

sudo /usr/lib/systemd/systemd-sysupdate update --component gcc

If you want to use the new version immediately, make sure to refresh the merged sysexts:

sudo systemctl restart systemd-sysext.service
systemd-sysext status

To update all sysexts on a system:

for c in $(/usr/lib/systemd/systemd-sysupdate components --json=short | jq --raw-output '.components[]'); do
    sudo /usr/lib/systemd/systemd-sysupdate update --component "${c}"
done
Uninstall

Define a helper function:

uninstall_sysext() {
  SYSEXT="${1}"
  sudo rm -i "/var/lib/extensions/${SYSEXT}.raw"
  sudo rm -i "/var/lib/extensions.d/${SYSEXT}-"*".raw"
  sudo rm -i "/etc/sysupdate.${SYSEXT}.d/${SYSEXT}.transfer" || sudo rm -i "/etc/sysupdate.${SYSEXT}.d/${SYSEXT}.conf"
  sudo rmdir "/etc/sysupdate.${SYSEXT}.d/"
}

Uninstall the sysext:

uninstall_sysext gcc

Reboot your system or refresh the merged sysexts:

sudo systemctl restart systemd-sysext.service
systemd-sysext status