[yocto] using clang for one recipe

Trevor Woerner twoerner at gmail.com
Fri Jun 23 15:39:16 PDT 2017

I want to have one recipe build with clang instead of gcc (gcc is
being used for the rest of the image). I thought this was as simple as
adding the following line to the recipe:

    TOOLCHAIN = "clang"

Adding that line, and adding meta-clang to bblayers.conf, did get the
llvm/clang compiler built and installed to recipe-sysroot-native. But
the moment it starts to build the package, it fails immediately with:

    | fatal error: 'string' file not found
    | #include <string>
    |          ^~~~~~~~

Did I miss a step? That seems like a pretty basic thing that would be
needed for using a toolchain. If feels like I'm missing something;
like I need to add something else to my local.conf. Thoughts?

I went looking for examples of recipes using clang and found
meta-openembedded/meta-oe/recipes-support/tbb.bb which includes:

    COMPILER ?= "gcc"
    COMPILER_toolchain-clang = "clang"

Odd. Why "COMPILER" and not "TOOLCHAIN" like meta-clang's README mentions?

Best regards,

More information about the yocto mailing list