[yocto] using clang for one recipe

Khem Raj raj.khem at gmail.com
Fri Jun 23 19:45:40 PDT 2017

On Fri, Jun 23, 2017 at 6:55 PM, Trevor Woerner <twoerner at gmail.com> wrote:
> On Fri 2017-06-23 @ 03:57:06 PM, Khem Raj wrote:
>> On Fri, Jun 23, 2017 at 3:39 PM, Trevor Woerner <twoerner at gmail.com> wrote:
>> > 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'm investigating moving chromium to a newer version, specifically something
> much closer to the current Linux stable (59.0.3071.109). My understanding is
> the chromium developers use clang, which would explain why it's always so much
> work to get it to compile with gcc. If I can get chromium to build with clang,
> I think it would make future maintenance much easier. Switching from gyp to gn
> was easy, but getting this newer version to build with gcc7 is a challenge.
> When I go to the recipe-sysroot-native, I find clang in usr/bin. But from that
> base location if I do a
>         $ find . -name "*string*" -print
> I don't find any such include files. Should they not be installed to the
> native sysroot alongside clang itself?
> Here's one example of a failing compile:
> | [16/25529] CXX obj/base/allocator/tcmalloc/sysinfo.o
> | FAILED: obj/base/allocator/tcmalloc/sysinfo.o
> | ../../../recipe-sysroot-native/usr/bin/clang++ -MMD -MF obj/base/allocator/tcmalloc/sysinfo.o.d -DNO_HEAP_CHECK -DV8_DEPRECATION_WARNINGS -DUSE_UDEV -DUSE_AURA=1 -DUSE_PANGO=1 -DUSE_CAIRO=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -DUSE_X11=1 -DDISABLE_NACL -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -DENABLE_MEDIA_ROUTER=1 -DFIELDTRIAL_TESTING_ENABLED -DCR_CLANG_REVISION=\"299960-1\" -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DCOMPONENT_BUILD -D_DEBUG -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWTF_USE_DYNAMIC_ANNOTATIONS=1 -DTCMALLOC_FOR_DEBUGALLOCATION -DTCMALLOC_DONT_REPLACE_SYSTEM_ALLOC -I../../base/allocator -I../../third_party/tcmalloc/chromium/src/base -I../../third_party/tcmalloc/chromium/src -I../.. -Igen -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -funwind-tables -fPIC -pipe -fcolor-diagnostics --target=arm-linux-gnueabihf -march=armv7-a -mfloat-abi=hard -mtune=generic-armv7-a -pthread -mfpu=neon -O0 -fno-omit-frame-pointer -g2 --sysroot=../../build/linux/debian_jessie_arm-sysroot -fvisibility=hidden -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wall -Wno-unused-variable -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-covered-switch-default -Wno-unneeded-internal-declaration -Wno-inconsistent-missing-override -Wno-undefined-var-template -Wno-nonportable-include-path -Wno-address-of-packed-member -Wno-unused-lambda-capture -Wno-user-defined-warnings -Wno-reorder -Wno-unused-function -Wno-unused-local-typedefs -Wno-unused-private-field -Wno-sign-compare -Wno-unused-result -fvisibility-inlines-hidden -Wno-undefined-bool-conversion -Wno-tautological-undefined-compare -std=gnu++11 -fno-rtti -fno-exceptions -Wno-deprecated -c ../../third_party/tcmalloc/chromium/src/base/sysinfo.cc -o obj/base/allocator/tcmalloc/sysinfo.o
> | In file included from ../../third_party/tcmalloc/chromium/src/base/sysinfo.cc:62:
> | In file included from ../../third_party/tcmalloc/chromium/src/base/sysinfo.h:49:
> | In file included from ../../third_party/tcmalloc/chromium/src/base/logging.h:49:
> | ../../third_party/tcmalloc/chromium/src/base/commandlineflags.h:52:10: fatal error: 'string' file not found
> | #include <string>
> |          ^~~~~~~~
> | 1 error generated.
> I can send you the non-working, partial recipe if you're interested too.

Yes chrome uses clang primarily. I think whats missing it dependency
on C++ runtime. default is libstdc++ so I guess you have to add a
dependency on gcc-runtime

More information about the yocto mailing list