On Monday, 15 July 2024, 16:18:14 CEST, Khem Raj wrote:
> On Mon, Jul 15, 2024 at 5:18 AM Christian Eggers via lists.openembedded.org
> <[email protected]> wrote:
> 
> > Based on proposal send previously here:
> > https://lists.yoctoproject.org/g/yocto/topic/recipe_for/83279588
> >
> > This recipe depends on meta-clang, so should it be added to that layer?
> >
> > Unfortunately the 'include-what-you-use' (iwyu) tool doesn't work yet.
> > Although I have installed nativesdk-clang (via CLANGSDK = "1") and
> > nativesdk-include-what-you-use packages, the C++ standard headers are
> > not found:
> >
> > include-what-you-use
> > --sysroot=/opt/poky/5.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-musleabi
> > impl/Fdt.cpp
> > impl/Fdt.cpp:9:10: fatal error: 'cerrno' file not found
> >     9 | #include <cerrno>
> >       |          ^~~~~~~~
> >
> > As iwyu uses Clang and I have no experience working with it, this is
> > probably only a beginner mistake. Can Clang use the C++ headers provided
> > by libstdc++, or do I need to install further packages?
> >
> 
> It can but it seems your SDK install might be missing any c++ runtime so
> check a simple program that includes say <iostream> header and try
> compiling it
My SDK definitely contains std:: C++ headers for target and nativesdk. But the
libstdc++ C++ headers are installed in GCC specific locations:

/opt/poky/5.0.2/sysroots/x86_64-pokysdk-linux/usr/include/c++/13.3.0/
/opt/poky/5.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-musleabi/usr/include/c++/13.3.0

How can Clang know that the C++ headers are located in the (GCC specific) 
c++/13.3.0
sub directory?


> 
> 
> > Signed-off-by: Christian Eggers <[email protected]>
> > ---
> >  .../include-what-you-use_git.bb               | 22 +++++++++++++++++++
> >  1 file changed, 22 insertions(+)
> >  create mode 100644 meta-oe/recipes-devtools/include-what-you-use/
> > include-what-you-use_git.bb
> >
> > diff --git a/meta-oe/recipes-devtools/include-what-you-use/
> > include-what-you-use_git.bb
> > b/meta-oe/recipes-devtools/include-what-you-use/
> > include-what-you-use_git.bb
> > new file mode 100644
> > index 000000000000..e7df6a834a34
> > --- /dev/null
> > +++ b/meta-oe/recipes-devtools/include-what-you-use/
> > include-what-you-use_git.bb
> > @@ -0,0 +1,22 @@
> > +LICENSE = "NCSA"
> > +LIC_FILES_CHKSUM =
> > "file://LICENSE.TXT;md5=59d01ad98720f3c50d6a8a0ef3108c88 \
> > +
> > file://iwyu-check-license-header.py;md5=7bdb749831163fbe9232b3cb7186116f"
> > +
> > +SRC_URI = "git://
> > github.com/include-what-you-use/include-what-you-use.git;protocol=https;branch=clang_18
> > "
> > +
> > +PV = "0.22+git${SRCPV}"
> > +SRCREV = "377eaef70cdda47368939f4d9beabfabe3f628f0"
> > +
> > +S = "${WORKDIR}/git"
> > +
> > +DEPENDS = "clang"
> 
> 
> This means it needs to use clang as library to link to is that what it
> required or does it need clang as static compiler to build this package in
> which case you can do so by using TOOLCHAIN = “clang” in recipe
I think that it builds fine with the GCC toolchain, at least it doesn't
complain during build. Finally it links against libclang-cpp.so.18.1 and 
libLLVM.so.18.1, so using "DEPENDS" sounds correct for me.

Although I haven't configured Clang to provide also llvm (as described here
https://github.com/kraj/meta-clang?tab=readme-ov-file#providing-llvm),
there is a nativesdk-clang-libllvm package after building nativesdk-clang.
> 
> 
> > +
> > +inherit cmake python3native
> > +
> > +EXTRA_OECMAKE:append:class-nativesdk = " \
> > +       -DCMAKE_SKIP_RPATH:BOOL=ON \
> > +       "
> > +
> > +FILES:${PN} += "${datadir}/${BPN}"
> > +
> > +BBCLASSEXTEND = "nativesdk"
> > --
> > 2.44.1
> >
> >
> > 
> >
> >
> 




-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#111370): 
https://lists.openembedded.org/g/openembedded-devel/message/111370
Mute This Topic: https://lists.openembedded.org/mt/107229738/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to