Chapter 1. LLVM

1.1. About LLVM Toolset

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.

LLVM Toolset is distributed as a part of Red Hat Developer Tools for Red Hat Enterprise Linux 7. LLVM Toolset is available as a module for Red Hat Enterprise Linux 8.

The following components are available as a part of LLVM Toolset:

Table 1.1. LLVM Components

NameVersionDescription

clang

RHEL 7 — 11.0.1
RHEL 8 — 11.0.0

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

lldb

RHEL 7 — 11.0.1
RHEL 8 — 11.0.0

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

compiler-rt

RHEL 7 — 11.0.1
RHEL 8 — 11.0.0

Runtime libraries for LLVM.

llvm

RHEL 7 — 11.0.1
RHEL 8 — 11.0.0

A collection of modular and reusable compiler and toolchain technologies.

libomp

RHEL 7 — 11.0.1
RHEL 8 — 11.0.0

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

lld

RHEL 7 — 11.0.1
RHEL 8 — 11.0.0

An LLVM linker.

python-lit

RHEL 7 — 0.11.1
RHEL 8 — 0.11.0

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

Important

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 LLVM Toolset”.

1.2. Compatibility

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

  • AMD and Intel 64-bit architectures
  • The 64-bit ARM architecture (Only RHEL 8)
  • IBM Power Systems, Little Endian
  • IBM Power Systems, Big Endian (Only RHEL 7)
  • 64-bit IBM Z

1.3. Getting access to LLVM Toolset on Red Hat Enterprise Linux 7

This chapter lists the steps to perform before installing LLVM Toolset on a Red Hat Enterprise Linux 7 system. Complete the following steps to attach a subscription that provides access to the repository for Red Hat Developer Tools, and then enable the Red Hat Developer Tools and Red Hat Software Collections repositories.

Prerequisites

  • Verify that wget is installed on your system. The tool is available from the default Red Hat Enterprise Linux repositories. To install it, run the following command as root:

    # yum install wget

Procedure

  1. Get the latest subscription data from the server:

    # subscription-manager refresh
  2. Use the following command to register the system:

    # subscription-manager register

    You can also register the system by following the appropriate steps in Registering and Unregistering a System in the Red Hat Subscription Management document.

  3. Display a list of all subscriptions that are available for your system and identify the pool ID for the subscription:

    # subscription-manager list --available

    This command displays the subscription name, unique identifier, expiration date, and other details related to it. The pool ID is listed on a line beginning with Pool ID.

  4. Attach the subscription that provides access to the Red Hat Developer Tools repository. Use the pool ID you identified in the previous step.

    # subscription-manager attach --pool=<appropriate pool ID from the subscription>
  5. Verify the list of subscriptions attached to your system:

    # sudo subscription-manager list --consumed
  6. 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).

    Consider using Red Hat Enterprise Linux Server to access the widest range of the development tools.

  7. 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).

  8. Add the Red Hat Developer Tools GPG 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

Once the subscription is attached to the system and the repositories are enabled, install LLVM Toolset as described in Section 1.4, “Installing LLVM Toolset”.

Additional Resources

  • For more information on how to register your system using Red Hat Subscription Management and associate it with subscriptions, see the Red Hat Subscription Management collection of guides.

1.4. Installing LLVM Toolset

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 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 LLVM Toolset, see Section 1.3, “Getting access to LLVM Toolset on Red Hat Enterprise Linux 7”.

Important

Before installing LLVM Toolset, install all available Red Hat Enterprise Linux updates.

  1. Install all of the components included in LLVM Toolset for your operating system:

    • On Red Hat Enterprise Linux 7, install the llvm-toolset 11.0 collection:

      # yum install llvm-toolset-11.0
    • 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-11.0-cmake package:

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

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

# yum install cmake cmake-doc

1.4.1.1. CMake installable documentation

The cmake package contains installed documentation. On Red Hat Enterprise Linux 7, find the documentation in opt/rh/llvm-toolset-11.0/root/usr/share/doc/llvm-toolset-11.0-cmake-3.6.2/html/index.html. On Red Hat Enterprise Linux 8, find the documentation in /usr/share/doc/llvm/html/index.html.

1.4.2. Installable documentation

The following section describes how to install the LLVM Toolset installable documentation.

  • On Red Hat Enterprise Linux 7, install the llvm-doc-11.0 package:
# yum install llvm-toolset-11.0-llvm-doc

The documentation is available in /opt/rh/llvm-toolset-11.0/root/usr/share/doc/llvm-toolset-11.0-llvm-11.0/html/index.html.

  • On Red Hat Enterprise Linux 8, install the llvm-doc package:
# yum install llvm llvm-doc

The documentation is available in /usr/share/doc/llvm/html/index.html.

The documenation for CMake is not included in the LLVM documentation package. To install the documentation for CMake, see Section 1.4.1.1, “CMake installable documentation”.

1.5. Additional Resources

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

Online documentation