Why do I have to build LLVM when I already have clang installed?

People often ask why they are building devel/llvm## ports. Given the very long build times, this is quite reasonable. This page attempts to answer common questions on the subject.

Why not use the system clang?

Installing a (nearly) identical version of the compiler seems absurd, but this often happens. Usually this happens because a port (e.g. graphics/mesa-libs) depends on an LLVM library. The LLVM libraries do not have a stable interface and thus can not be shipped with the FreeBSD base system.

As a practical matter, modern video driver systems depend on LLVM.

Sometimes a different version of clang is required to work around a bug or to support a new language feature. This is less common.

Why are multiple versions of clang being installed?

Due to the unstable API of the various LLVM components, projects consuming LLVM libraries aren't always able to use the latest version of LLVM. Project often drop support for old LLVM versions over time. Taken together, this means a range of versions may be required for a given set of ports.

If you see an old version being installed, you might check with the project depending on it to see if they have updated and let the maintainer know. For projects that only work with very old versions, you should likely assume the project is abandoned and migrate to a new solution. An infrequently updated list of ports depending on old versions can be found at ObsoleteLLVMVersions.

WhyDoIHaveToBuildLLVMWhenIAlreadyHaveClangInstalled (last edited 2019-01-14T18:34:06+0000 by BrooksDavis)