How do I install clang 18 on Ubuntu?

software I need to use is requiring clang 18 to be installed on my computer:

em++: warning: LLVM version for clang executable "/usr/bin/clang" appears incorrect (seeing "14.0", expected "18") [-Wversion-check]

After little bit of searching I’ve learned I should use the command sudo apt install clang-18
Running that has given me E: Unable to locate package clang-18.

The software is requiring clang 18 but package manager can’t find it.
Do I need to include third party repository or something ? I’m on Ubuntu 22.04 .

Thank you for assistance.

Asked By: Mark

||

Using this guide you can install Clang 18.

In brief, there are 3 steps:

  1. Download the Automatic Installation Script using the Terminal –

    wget https://apt.llvm.org/llvm.sh
    

    After Downloading, add executable permission by running this command –

    chmod u+x llvm.sh
    
  2. Use the script to install Clang:

    sudo ./llvm.sh 18
    

    During the process, it will ask to hit Enter to confirm adding the apt repository. Then, you may just wait until the process done.

  3. Verify using the following code:

    clang-18 --version
    

    and/or locate clang-18 to verify.

Answered By: graham
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.