Chapter 14. Using the GCC Toolset container images

The GCC Toolset 9 components are available in the two container images:

  • GCC Toolset 9 Toolchain
  • GCC Toolset 9 Perftools

The GCC Toolset container images are based on the rhel8 base image and are available for all architectures supported by RHEL 8:

  • AMD and Intel 64-bit architectures
  • The 64-bit ARM architecture
  • IBM Power Systems, Little Endian
  • IBM Z

14.1. GCC Toolset container images contents

Tools versions provided in the GCC Toolset 9 container images match the GCC Toolset 9 components versions.

The GCC Toolset 9 Toolchain contents

The rhel8/gcc-toolset-9-toolchain image provides the GCC compiler, the GDB debugger, and other development-related tools. The container image consists of the following components:

ComponentPackage

gcc

gcc-toolset-9-gcc

g++

gcc-toolset-9-gcc++

gfortran

gcc-toolset-9-gfortran

gdb

gcc-toolset-9-gdb

The GCC Toolset 9 Perftools contents

The rhel8/gcc-toolset-9-perftools image provides a number of tools for debugging, performance monitoring, and further analysis of the applications. The container image consists of the following components:

ComponentPackage

Valgrind

gcc-toolset-9-valgrind

SystemTap

gcc-toolset-9-systemtap

Dyninst

gcc-toolset-9-dyninst

elfutils

gcc-toolset-9-elfutils

Additional resources

14.2. Accessing and running the GCC Toolset container images

The following section describes how to access and run the GCC Toolset 9 container images.

Prerequisites

  • Podman is installed.

Procedure

  1. Access the Red Hat Container Registry using your Customer Portal credentials:

    $ podman login registry.redhat.io
    Username: username
    Password: ********
  2. Pull a container image you require by running a relevant command as root:

    # podman pull registry.redhat.io/rhel8/gcc-toolset-9-toolchain
    # podman pull registry.redhat.io/rhel8/gcc-toolset-9-perftools
    Note

    On RHEL 8.1 and later versions, you can set up your system to work with containers as a non-root user. For details, see Running containers as root or rootless.

  3. Optional: Check that pulling was successful by running a command that lists all container images on your local system:

    # podman images
  4. Run a container by launching a bash shell inside a container:

    # podman run -it image_name /bin/bash

    The -i option creates an interactive session; without this option the shell opens and instantly exits.

    The -t option opens a terminal session; without this option you cannot type anything to the shell.

Additional resources

14.3. Example: Using the GCC Toolset 9 Toolchain container image

This example shows how to pull and start using the GCC Toolset 9 Toolchain container image.

Prerequisites

  • Podman is installed.

Procedure

  1. Access the Red Hat Container Registry using your Customer Portal credentials:

    $ podman login registry.redhat.io
    Username: username
    Password: ********
  2. Pull the container image as root:

    # podman pull registry.redhat.io/rhel8/gcc-toolset-9-toolchain
  3. Launch the container image with an interactive shell as root:

    # podman run -it registry.redhat.io/rhel8/gcc-toolset-9-toolchain /bin/bash
  4. Run the GCC Toolset tools as expected. For example, to verify the gcc compiler version, run:

    bash-4.4$ gcc -v
    ...
    gcc version 9.2.1 20191120 (Red Hat 9.2.1-2) (GCC)
  5. To list all packages provided in the container, run:

    bash-4.4$ rpm -qa