How to install clang 16.0 in ubuntu

Hi,

I downloaded clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu and extract all but how do I make clang and other binaries to be callable from any terminal?

I have clang 14.0 installed but I have not found a clang 16.0 installer for linux..
If you just type the program name (e.g. "clang") without a full or relative path, then the shell will search for the program (executable file) in the directories listed in the PATH environment variable. Type echo $PATH to print out those directories.

You can add another directory, e.g. your Clang install directory, to PATH like this:
export PATH=/path/to/whatever:$PATH

For example:
export PATH=/home/john/Downloads/clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu/bin:$PATH

Be sure to add the path to the "bin" sub-directory inside the Clang directory!

You may want to add the above command to your ".bashrc" file, so that you don't have to do it again for every new shell.


I have clang 14.0 installed but I have not found a clang 16.0 installer for linux.

In Linux, you don't usually have an "installer". Most of the time, you will just install applications via your distribution's package manager. In Ubuntu, this would be apt. If the desired application is not available via the package manager (or the available version is too old), in the default package repository, then you still may add a third-party repository. Have a look here: https://apt.llvm.org/

To install a specific version of LLVM:
1
2
3
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh <version number>
Last edited on
Topic archived. No new replies allowed.