Chapter 1. Clang and LLVM

1.1. About the Clang and LLVM toolset

The Clang and LLVM toolset is a Red Hat offering for developers on the Red Hat Enterprise Linux platform. It provides the LLVM compiler infrastructure framework, the Clang compiler for the C and C++ languages, the LLDB debugger, and related tools for code analysis.

The Clang and LLVM toolset is distributed as a part of Red Hat Developer Tools for Red Hat Enterprise Linux 7 and is available as a module in Red Hat Enterprise Linux 8.

The following components are available as a part of the Clang and LLVM toolset:

Table 1.1. Clang and LLVM Components

NameVersionDescription

clang

8.0.1

A LLVM compiler front end for C and C++.

lldb

8.0.1

A C and C++ debugger using portions of LLVM.

compiler-rt

8.0.1

Runtime libraries for LLVM.

llvm

8.0.1

A collection of modular and reusable compiler and toolchain technologies.

libomp

8.0.1

A library for utilization of Open MP API specification for parallel programming.

lld

8.0.1

A LLVM linker.

python-lit

RHEL 7 — 0.8.0
RHEL 8 — 0.9.0

A Software testing tool for LLVM- and Clang-based test suites.

Important

Clang and LLVM toolset for Red Hat Enterprise Linux 7 also provides CMake as a separate package. On Red Hat Enterprise Linux 8, CMake is available in the system repository. For more information on how to install CMake, see Section 1.4, “Installing the Clang and LLVM toolset”.

1.2. Compatibility

The Clang and LLVM toolset is available for Red Hat Enterprise Linux 7 and Red Hat Enterprise Linux 8 on the following architectures:

  • The 64-bit Intel and AMD architectures
  • The 64-bit ARM architecture
  • The IBM Power Systems architecture
  • The little-endian variant of IBM Power Systems architecture
  • The IBM Z Systems architecture

1.3. Getting access to the Clang and LLVM toolset on Red Hat Enterprise Linux 7

The Clang and LLVM toolset is an offering that is distributed as a part of the Red Hat Developer Tools content set, which is available to customers with deployments of Red Hat Enterprise Linux 7. To install the Clang and LLVM toolset, enable the Red Hat Developer Tools and Red Hat Software Collections repositories by using the Red Hat Subscription Management and add the Red Hat Developer Tools GPG key to your system.

  1. Enable the rhel-7-variant-devtools-rpms repository:

    # subscription-manager repos --enable rhel-7-variant-devtools-rpms

    Replace variant with the Red Hat Enterprise Linux system variant (server or workstation).

    Note

    We recommend developers to use Red Hat Enterprise Linux Server for access to the widest range of development tools.

  2. Enable the rhel-variant-rhscl-7-rpms repository:

    # subscription-manager repos --enable rhel-variant-rhscl-7-rpms

    Replace variant with the Red Hat Enterprise Linux system variant (server or workstation).

  3. Add the Red Hat Developer Tools key to your system:

    # cd /etc/pki/rpm-gpg
    # wget -O RPM-GPG-KEY-redhat-devel https://www.redhat.com/security/data/a5787476.txt
    # rpm --import RPM-GPG-KEY-redhat-devel

After the subscription is attached to the system and repositories enabled, install the Clang and LLVM toolset as described in Section 1.4, “Installing the Clang and LLVM toolset”.

Additional Resources

1.4. Installing the Clang and LLVM toolset

The Clang and LLVM toolset is distributed as a collection of RPM packages that can be installed, updated, uninstalled, and inspected by using the standard package management tools that are included in Red Hat Enterprise Linux. Note that a valid subscription that provides access to the Red Hat Developer Tools content set is required in order to install the Clang and LLVM toolset on your Red Hat Enterprise Linux 7 system. For detailed instructions on how to associate your Red Hat Enterprise Linux 7 system with an appropriate subscription and get access to the Clang and LLVM toolset, see Section 1.3, “Getting access to the Clang and LLVM toolset on Red Hat Enterprise Linux 7”.

Important

Before installing the Clang and LLVM toolset, install all available Red Hat Enterprise Linux updates.

  1. Install all of the components included in the Clang and LLVM toolset for your operating system:

    • On Red Hat Enterprise Linux 7, install the llvm-toolset-8.0.1 package:

      # yum install llvm-toolset-8.0.1
    • On Red Hat Enterprise Linux 8, install the llvm-toolset module:

      # yum module install llvm-toolset

      This installs all development and debugging tools, and other dependent packages to the system.

1.4.1. Installing CMake on Red Hat Enterprise Linux

CMake is available as a separate package. To install CMake:

On Red Hat Enterprise Linux 7, install the llvm-toolset-8.0-cmake package:

# yum install llvm-toolset-8.0-cmake llvm-toolset-8.0-cmake-doc

On Red Hat Enterprise Linux 8, install the cmake package:

# yum install cmake cmake-doc

1.5. Additional Resources

A detailed description of the Clang and LLVM toolset and all its features is beyond the scope of this document. For more information, see the resources listed below.

Online documentation