[yocto] using clang for one recipe

Khem Raj raj.khem at gmail.com
Fri Jun 23 15:57:06 PDT 2017

On Fri, Jun 23, 2017 at 3:39 PM, Trevor Woerner <twoerner at gmail.com> wrote:
> 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"

yes thats what should do it.

> 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?
> Suggestions?

which package is it ? it seems its missing proper -I paths.?

> 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?

this is tbb specific variable not clang or gcc specific.

> Best regards,
>     Trevor

More information about the yocto mailing list