About this Install Guide

This guide is intended to get you up and running with this tool quickly with the most common settings. For a thorough review of all options, refer to the official documentation.

BOLT is an open-source post-link binary optimization tool developed to speed up large applications. It does this by optimizing the application’s code layout based on performance profile samples collected during execution.

Before you begin

This article provides quick instructions to download and install BOLT. The instructions are for Debian-based Linux distributions, but can be adapted for other Linux distributions.

  1. Install Git

Install Git using the documentation for your operating system.

Many Linux distributions include Git so you may not need to install it.

  1. Install CMake
    

        
        
            sudo apt install cmake -y
        
    

Check it is installed:

    

        
        
            cmake --version
        
    

The version is printed:

    

        
        cmake version 3.22.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

        
    

For more information refer to the CMake install guide.

  1. Install Ninja
    

        
        
            sudo apt install ninja-build -y
        
    

Check it is installed:

    

        
        
            ninja --version
        
    

The version is printed:

    

        
        1.10.0

        
    
  1. Install Clang
    

        
        
            sudo apt install clang -y
        
    

Check it is installed:

    

        
        
            clang --version
        
    

The version is printed:

    

        
        Ubuntu clang version 14.0.0-1ubuntu1.1
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

        
    

Install BOLT

You can install BOLT in 2 different ways, by building the source code or by downloading a binary release from GitHub.

Option 1: Download, build, and install BOLT from source code

  1. Clone the repository
    

        
        
            cd $HOME
git clone https://github.com/llvm/llvm-project.git
        
    
  1. Build BOLT
    

        
        
            cd llvm-project
mkdir build
cd build
cmake -G Ninja ../llvm -DLLVM_TARGETS_TO_BUILD="X86;AArch64" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PROJECTS="bolt"
ninja bolt
        
    

Build time depends on your machine configuration, and it may take several minutes to complete.

  1. Add the path to BOLT in your .bashrc file
    

        
        
            echo 'export PATH="$PATH:$HOME/llvm-project/build/bin"' >> ~/.bashrc
source ~/.bashrc
        
    

You are now ready to verify BOLT is installed .

Option 2: Download and install BOLT using a binary release

  1. Download a binary release

For Arm Linux use the file with aarch64 in the name:

    

        
        
            cd $HOME
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.5/clang+llvm-17.0.5-aarch64-linux-gnu.tar.xz
        
    
  1. Extract the downloaded file
    

        
        
            tar xvf clang+llvm-17.0.5-aarch64-linux-gnu.tar.xz
        
    
  1. Add the path to BOLT in your .bashrc file
    

        
        
            echo 'export PATH="$PATH:$HOME/clang+llvm-17.0.5-aarch64-linux-gnu/bin"' >> ~/.bashrc
source ~/.bashrc
        
    

Verify BOLT is installed

  1. Confirm BOLT applications perf2bolt and llvm-bolt are installed

Check the perf2bolt command:

    

        
        
            perf2bolt
        
    

The expected output is:

    

        
        perf2bolt: Not enough positional command line arguments specified!
Must specify at least 1 positional argument: See: perf2bolt --help

        
    

Check the llvm-bolt command:

    

        
        
            llvm-bolt
        
    

The expected output is:

    

        
        llvm-bolt: Not enough positional command line arguments specified!
Must specify at least 1 positional argument: See: llvm-bolt --help

        
    
  1. Print the BOLT version
    

        
        
            llvm-bolt --version
        
    

The output is similar to:

    

        
        LLVM (http://llvm.org/):
  LLVM version 18.0.0git
  Optimized build with assertions.
BOLT revision 99c15eb49ba0b607314b3bd221f0760049130d97

  Registered Targets:
    aarch64    - AArch64 (little endian)
    aarch64_32 - AArch64 (little endian ILP32)
    aarch64_be - AArch64 (big endian)
    arm64      - ARM64 (little endian)
    arm64_32   - ARM64 (little endian ILP32)
    x86        - 32-bit X86: Pentium-Pro and above
    x86-64     - 64-bit X86: EM64T and AMD64

        
    

You will see additional Registered Targets if you downloaded a binary release.

You are ready to use BOLT on your Linux machine.


Feedback

How would you rate the overall quality of this tool quick-install guide?