Chapter 15. Red Hat Developer Toolset Images

Red Hat Developer Toolset is a Red Hat offering for developers on the Red Hat Enterprise Linux platform. It provides a complete set of development and performance analysis tools that can be installed and used on multiple versions of Red Hat Enterprise Linux. Executables built with the Red Hat Developer Toolset toolchain can then also be deployed and run on multiple versions of Red Hat Enterprise Linux. For detailed compatibility information, see Red Hat Developer Toolset 12 User Guide.

Important

Only container images providing the latest version of Red Hat Developer Toolset are supported.

15.1. Running Red Hat Developer Toolset Tools from Pre-Built Container Images

To display general usage information for pre-built Red Hat Developer Toolset container images that you have already pulled to your local machine, run the following command as root:

# podman run image_name usage

To launch an interactive shell within a pre-built container image, run the following command as root:

# podman run -ti image_name /bin/bash -l

In both of the above commands, substitute the image_name parameter with the name of the container image you pulled to your local system and now want to use.

For example, to launch an interactive shell within the container image with selected toolchain components, run the following command as root:

# podman run -ti rhscl/devtoolset-12-toolchain-rhel7 /bin/bash -l

Example 15.1. Using GCC in the Pre-Built Red Hat Developer Toolset Toolchain Image

This example illustrates how to obtain and launch the pre-built container image with selected toolchain components of the Red Hat Developer Toolset and how to run the gcc compiler within that image.

  1. Make sure you have a container environment set up properly on your system by following instructions at Using podman to work with containers in the Managing Containers document.
  2. Pull the pre-built toolchain Red Hat Developer Toolset container image from the official Red Hat Container Registry:

    # podman pull rhscl/devtoolset-12-toolchain-rhel7
  3. To launch the container image with an interactive shell, issue the following command:

    # podman run -ti rhscl/devtoolset-12-toolchain-rhel7 /bin/bash -l
  4. To launch the container as a regular (non-root) user, use the sudo command. To map a directory from the host system to the container file system, include the -v (or --volume) option in the podman command:

    $ sudo podman run -v ~/Source:/src -ti rhscl/devtoolset-12-toolchain-rhel7 /bin/bash -l

    In the above command, the host’s ~/Source/ directory is mounted as the /src/ directory within the container.

  5. Once you are in the container’s interactive shell, you can run Red Hat Developer Toolset tools as expected. For example, to verify the version of the gcc compiler, run:

    bash-4.2$ gcc -v
    [...]
    gcc version 12.1.1 20220628 (Red Hat 12.1.1-3) (GCC)

Additional Resources

For more information about components available in Red Hat Developer Toolset, see the following online resources:

15.2. Red Hat Developer Toolset Toolchain Container Image

15.2.1. Description

The Red Hat Developer Toolset Toolchain image provides the GNU Compiler Collection (GCC) and GNU Debugger (GDB).

The rhscl/devtoolset-12-toolchain-rhel7 image contains content corresponding to the following packages:

ComponentVersionPackage

gcc

12.1.1

devtoolset-12-gcc

g++

devtoolset-12-gcc-c++

gfortran

devtoolset-12-gcc-gfortran

gdb

11.2

devtoolset-12-gdb

Additionally, the devtoolset-12-binutils package is included as a dependency.

15.2.2. Access

To pull the rhscl/devtoolset-12-toolchain-rhel7 image, run the following command as root:

# podman pull registry.redhat.io/rhscl/devtoolset-12-toolchain-rhel7

15.3. Red Hat Developer Toolset Performance Tools Container Image

15.3.1. Description

The Red Hat Developer Toolset Performance Tools image provides a number of profiling and performance measurement tools.

The rhscl/devtoolset-12-perftools-rhel7 image includes the following components:

ComponentVersionPackage

dwz

0.14

devtoolset-12-dwz

Dyninst

12.1.0

devtoolset-12-dyninst

elfutils

0.187

devtoolset-12-elfutils

ltrace

0.7.91

devtoolset-12-ltrace

make

4.3

devtoolset-12-make

memstomp

0.1.5

devtoolset-12-memstomp

OProfile

1.4.0

devtoolset-12-oprofile

strace

5.18

devtoolset-12-strace

SystemTap

4.7

devtoolset-12-systemtap

Valgrind

3.19.0

devtoolset-12-valgrind

Additionally, the devtoolset-12-gcc and devtoolset-12-binutils packages are included as a dependency.

15.3.2. Access

To pull the rhscl/devtoolset-12-perftools-rhel7 image, run the following command as root:

# podman pull registry.redhat.io/rhscl/devtoolset-12-perftools-rhel7

15.3.3. Usage

Using the SystemTap Tool from Container Images

When using the SystemTap tool from a container image, additional configuration is required, and the container needs to be run with special command-line options.

The following three conditions need to be met:

  1. The image needs to be run with super-user privileges. To do this, run the image using the following command:

    ~]$ podman run --ti --privileged --ipc=host --net=host --pid=host devtoolset-12-my-perftools /bin/bash -l

    To use the pre-built perftools image, substitute the image name for devtoolset-12-perftools-rhel7 in the above command.

  2. The following kernel packages need to be installed in the container:

    • kernel
    • kernel-devel
    • kernel-debuginfo

      The version and release numbers of the above packages must match the version and release numbers of the kernel running on the host system. Run the following command to determine the version and release numbers of the hosts system’s kernel:

      ~]$ uname -r
      3.10.0-1160.76.1.el7.x86_64

      Note that the kernel-debuginfo package is only available from the Debug repository. Enable the rhel-7-server-debug-rpms repository. For more information on how to get access to debuginfo packages, see How can I download or install debuginfo packages for RHEL systems?.

      To install the required packages with the correct version, use the yum package manager and the output of the uname command. For example, to install the correct version of the kernel package, run the following command as root:

      ~]# yum install -y kernel-$(uname -r)
  3. Save the container to a reusable image by executing the podman commit command. To save a custom-built SystemTap container:

    ~]$ podman commit devtoolset-12-systemtap-$(uname -r)