Chapter 11. 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 8 User Guide and Red Hat Developer Toolset 7 User Guide.

11.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-7-toolchain-rhel7 /bin/bash -l

Example 11.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-7-toolchain-rhel7
  3. To launch the container image with an interactive shell, issue the following command:

    # podman run -ti rhscl/devtoolset-7-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-7-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 6.3.1 20170216 (Red Hat 6.3.1-3) (GCC)

11.2. Using Container Images Built from Dockerfiles

Dockerfiles are available for selected Red Hat Developer Toolset components. Dockerfiles are text files that contain instructions for automated building of container images.

Red Hat Developer Toolset 7.1 for Red Hat Enterprise Linux 7 is distributed with the following Dockerfiles:

  • devtoolset-7-toolchain
  • devtoolset-7-perftools

Red Hat Developer Toolset 8.1 for Red Hat Enterprise Linux 7 is distributed with the following Dockerfiles:

  • devtoolset-8-toolchain
  • devtoolset-8-perftools

11.2.1. Obtaining Dockerfiles

The Red Hat Developer Toolset Dockerfiles are provided in the Red Hat Container Catalog. Every tagged container image is provided with the Dockerfile used to build it.

To get the Dockerfiles, follow this procedure:

  1. Open the Red Hat Container Catalog page website for the latest container image in the Red Hat Developer Toolset version you want:

  2. Copy the Dockerfile contents from the webpage.
  3. Paste the text to a suitably named plain text file on your system.
Note

Previously, Red Hat Developer Toolset Dockerfiles were provided by the package devtoolset-8-dockerfiles. This package has been removed in Red Hat Developer Toolset version 8.1.

11.2.2. Building Container Images

Change to the directory where the Dockerfile is installed and run the following command as root:

# podman build -t image_name

Replace image_name with the desired name for the new image.

Example 11.2. Building a Container Image with a Red Hat Developer Toolset Component

To build a container image for deploying the perftools tools from Red Hat Developer Toolset 8.1 in a container, follow the instructions below:

  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. Copy the Dockerfile contents text from the Red Hat Container Catalog page for Red Hat Developer Toolset 8.1 perftools image.
  3. Paste the text into a text editor and save it as the file /home/user/devtoolset-8-toolchain-rhel7/Dockerfile

    Replace user with name of the current user. To determine this value, run the whoami command in the terminal.

  4. Change to the directory with the file:

    # cd /home/user/devtoolset-8-toolchain-rhel7/
  5. Build the container image:

    # podman build -t devtoolset-8-my-perftools .

    Replace devtoolset-8-my-perftools with the name you wish to assign to your resulting container image.

11.2.3. Running Red Hat Developer Toolset Tools from Custom-Built Container Images

To display general usage information for images built from Red Hat Developer Toolset Dockerfiles (see Section 11.2.2, “Building Container Images”), run the following command as root:

podman run image_name container-usage

To launch an interactive shell within a container image you built, 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 chose when building it.

Example 11.3. Using elfutils in a Custom-Built Red Hat Developer Toolset Image

This example illustrates how to launch a custom-built container image with the elfutils component and how to run the eu-size tool within that image.

  1. To launch the container image with an interactive shell, issue the following command:

    # podman run -ti devtoolset-7-my-perftools /bin/bash -l
  2. 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 devtoolset-7-my-perftools /bin/bash -l

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

  3. 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 eu-size tool, run:

    bash-4.2$ eu-size -V
    size (elfutils) 0.168
    [...]

11.3. Additional Resources

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

11.4. Red Hat Developer Toolset Toolchain

11.4.1. Description

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

The rhscl/devtoolset-8-toolchain-rhel7 image provides content corresponding to the following packages:

ComponentVersionPackage

gcc

8.3.1

devtoolset-8-gcc

g++

devtoolset-8-gcc-c++

gfortran

devtoolset-8-gcc-fortran

gdb

8.2

devtoolset-8-gdb

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

The rhscl/devtoolset-7-toolchain-rhel7 image provides content corresponding to the following packages:

ComponentVersionPackage

gcc

7.3.1

devtoolset-7-gcc

g++

devtoolset-7-gcc-c++

gfortran

devtoolset-7-gcc-fortran

gdb

8.0.1

devtoolset-7-gdb

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

11.4.2. Access

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

# podman pull registry.access.redhat.com/rhscl/devtoolset-8-toolchain-rhel7

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

# podman pull registry.access.redhat.com/rhscl/devtoolset-7-toolchain-rhel7

11.5. Red Hat Developer Toolset Performance Tools

11.5.1. Description

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

The rhscl/devtoolset-8-perftools-rhel7 image provides the following components:

ComponentVersionPackage

dwz

0.12

devtoolset-8-dwz

Dyninst

9.3.2

devtoolset-8-dyninst

elfutils

0.176

devtoolset-8-elfutils

ltrace

0.7.91

devtoolset-8-ltrace

make

4.2.1

devtoolset-8-make

memstomp

0.1.5

devtoolset-8-memstomp

OProfile

1.3.0

devtoolset-8-oprofile

strace

4.24

devtoolset-8-strace

SystemTap

3.3

devtoolset-8-systemtap

Valgrind

3.14.0

devtoolset-8-valgrind

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

The rhscl/devtoolset-7-perftools-rhel7 image provides the following components:

ComponentVersionPackage

dwz

0.12

devtoolset-7-dwz

Dyninst

9.3.2

devtoolset-7-dyninst

elfutils

0.170

devtoolset-7-elfutils

ltrace

0.7.91

devtoolset-7-ltrace

make

4.2.1

devtoolset-7-make

memstomp

0.1.5

devtoolset-7-memstomp

OProfile

1.2.0

devtoolset-7-oprofile

strace

4.17

devtoolset-7-strace

SystemTap

3.1

devtoolset-7-systemtap

Valgrind

3.13.0

devtoolset-7-valgrind

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

11.5.2. Access

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

# podman pull registry.access.redhat.com/rhscl/devtoolset-8-perftools-rhel7

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

# podman pull registry.access.redhat.com/rhscl/devtoolset-7-perftools-rhel7

11.5.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-7-my-perftools /bin/bash -l

    To use the pre-built perftools image, substitute the image name for devtoolset-7-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-514.10.2.el7.x86_64

      Note that the kernel-debuginfo package is only available from the Debug channel. Enable the rhel-7-server-debug-rpms repository as described in TODO WHERE. For more information on how to get access to debuginfo packages, see https://access.redhat.com/site/solutions/9907.

      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-7-systemtap-$(uname -r)