Ubuntu – How to Clang static analyzer (scan-build) be installed on Ubuntu 18.04

18.04aptclang

In Ubuntu 16.04, I could:

$ sudo apt install clang
$ scan-build --help
USAGE: scan-build [options] <build command> [build options]
...

But in Ubuntu 18.04, after installing clang, the scan-build executable is not installed.

How can I use apt to install the Clang static analyzer on Ubuntu 18.04?

Best Answer

Based on a search at packages.ubuntu.com, it appears that scan-build has been split into a separate clang-tools package.

More precisely, clang is a dependency package that, on 18.04, installs clang-6.0, while clang-tools depends on the corresponding clang-tools-6.0 - which is the actual package that provides scan-tools for the current version of clang.

Related Question