Using clang from the base system

See clang and the base system.

When you have a NetBSD built with at least MKLLVM=yes, you can set

PKGSRC_COMPILER=       clang
CLANGBASE=             /usr
HAVE_LLVM=             yes

in your /etc/mk.conf to use it. You must do that before building packages, especially libtool. It's usually fine to link binaries generated from gcc to those generated with clang or vice versa.

\todo: Explain why HAVE_LLVM is set to use clang for pkgsrc.

Using clang from pkgsrc

You can build clang from pkgsrc (lang/clang). However, it needs libstdc++ from the base system, and needs gcc 4.8 or higher. It also depends on cmake, which requires c++11, which needs gcc 4.8 or higher. So this will not work on NetBSD <= 6.

Once built, you should (\todo test this) be able to set:

PKGSRC_COMPILER=       clang
CLANGBASE=             /usr/pkg

and perhaps

HAVE_LLVM=             yes

The caveats above about using a consistent compiler apply.

Add a comment