Installing latest stable LLVM in a bare Linux container with apt
I got used to develop in debian:buster-slim containers as they have a minimal memory footprint and still allow me to get the all the tools easily via apt.
One of the most frequent tasks is installing the latest stable Clang and other LLVM tools. The LLVM foundation provides an apt package source and a very handy script to install them. Bare Linux containers, however, don’t come with the required tools and so each time I set up a new environment, it bumps me to install them one after the other. This is a reminder to myself on what to install upfront:
> apt update
> apt install lsb-release wget software-properties-common gnupg2
> bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
This installs clang, lldb, lld and clangd. It also adds the right apt.llvm.org repository to your apt package sources, so we can move on quickly and install more tools from the same release.
Discuss on Reddit