include-what-you-use: new recipe
RFC PATCH 1/1 include-what-you-use: new recipe
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?
--- .../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
meta-oe/recipes-devtools/include-what-you-use/include-what-you-use_git.bb new file +22 -0
@@ -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" + +inherit cmake python3native + +EXTRA_OECMAKE:append:class-nativesdk = " \ + -DCMAKE_SKIP_RPATH:BOOL=ON \ + " + +FILES:${PN} += "${datadir}/${BPN}" + +BBCLASSEXTEND = "nativesdk"
Signature · 1 line
2.44.1
Quoted 17 lines · Christian Eggers via lists.openembedded.org
Based on proposal send previously here:
https://lists.yoctoproject.org/g/yocto/topic/recipe_for/83279588This 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>
| ^~~~~~~~
Quoted 4 lines
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
Quoted 26 lines
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
(quoted diff) +0
-0include-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..e7df6a834a34meta-oe/recipes-devtools/include-what-you-use/ new file +0
-0include-what-you-use_git.bb
meta-oe/recipes-devtools/include-what-you-use/ new file +2
-0@@ -0,0 +1,22 @@ +LICENSE = "NCSA" +LIC_FILES_CHKSUM ="file://LICENSE.TXT;md5=59d01ad98720f3c50d6a8a0ef3108c88 \
+ file://iwyu-check-license-header.py;md5=7bdb749831163fbe9232b3cb7186116f"meta-oe/recipes-devtools/include-what-you-use/ new file +2
-0+ +SRC_URI = "git://github.com/include-what-you-use/include-what-you-use.git;protocol=https;branch=clang_18 "
meta-oe/recipes-devtools/include-what-you-use/
Quoted 7 lines
meta-oe/recipes-devtools/include-what-you-use/ new file +7
-0+ +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
Quoted 25 lines
meta-oe/recipes-devtools/include-what-you-use/ new file +10
-1+ +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 (#111360):
https://lists.openembedded.org/g/openembedded-devel/message/111360
Mute This Topic: https://lists.openembedded.org/mt/107229738/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 20 lines · Khem Raj
Quoted 17 lines · Christian Eggers via lists.openembedded.org
Based on proposal send previously here:
https://lists.yoctoproject.org/g/yocto/topic/recipe_for/83279588This 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>
| ^~~~~~~~
Quoted 8 lines
Quoted 4 lines
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?
Quoted 32 lines
Quoted 32 lines
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
(quoted diff) +0
-0include-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..e7df6a834a34meta-oe/recipes-devtools/include-what-you-use/ new file +0
-0include-what-you-use_git.bb
meta-oe/recipes-devtools/include-what-you-use/ new file +2
-0@@ -0,0 +1,22 @@ +LICENSE = "NCSA" +LIC_FILES_CHKSUM ="file://LICENSE.TXT;md5=59d01ad98720f3c50d6a8a0ef3108c88 \
+ file://iwyu-check-license-header.py;md5=7bdb749831163fbe9232b3cb7186116f"meta-oe/recipes-devtools/include-what-you-use/ new file +2
-0+ +SRC_URI = "git://github.com/include-what-you-use/include-what-you-use.git;protocol=https;branch=clang_18 "
meta-oe/recipes-devtools/include-what-you-use/ new file +4
-0+ +PV = "0.22+git${SRCPV}" +SRCREV = "377eaef70cdda47368939f4d9beabfabe3f628f0" +
Quoted 8 lines
meta-oe/recipes-devtools/include-what-you-use/
Quoted 3 lines
meta-oe/recipes-devtools/include-what-you-use/ new file +3
-0+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.
Quoted 28 lines
Quoted 27 lines
meta-oe/recipes-devtools/include-what-you-use/ new file +10
-1+ +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 (#111360):
https://lists.openembedded.org/g/openembedded-devel/message/111360
Mute This Topic: https://lists.openembedded.org/mt/107229738/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 36 lines · Christian Eggers
Quoted 1 line · Khem Raj
On Mon, Jul 15, 2024 at 5:18 AM Christian Eggers via
lists.openembedded.org
Quoted 7 lines
Quoted 5 lines · <[email protected]> wrote:
Based on proposal send previously here:
https://lists.yoctoproject.org/g/yocto/topic/recipe_for/83279588This recipe depends on meta-clang, so should it be added to that layer?
Quoted 7 lines
Quoted 7 lines
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
Quoted 7 lines
Quoted 7 lines
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
Quoted 6 lines
Quoted 2 lines
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:
Quoted 7 lines
/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.0How can Clang know that the C++ headers are located in the (GCC specific) c++/13.3.0
sub directory?
Try adding -stdlib=libstdc++ on clang cmdline
Quoted 88 lines
Quoted 8 lines
Quoted 8 lines
Signed-off-by Christian Eggers <[email protected]>--- .../include-what-you-use_git.bb | 22+++++++++++++++++++
Quoted 4 lines
Quoted 4 lines
1 file changed, 22 insertions(+) create mode 100644 meta-oe/recipes-devtools/include-what-you-use/include-what-you-use_git.bb
Quoted 15 lines
Quoted 12 lines
(quoted diff) +0
-0include-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..e7df6a834a34meta-oe/recipes-devtools/include-what-you-use/ new file +0
-0include-what-you-use_git.bb
meta-oe/recipes-devtools/include-what-you-use/ new file +2
-0@@ -0,0 +1,22 @@ +LICENSE = "NCSA" +LIC_FILES_CHKSUM =Quoted 3 lines
"file://LICENSE.TXT;md5=59d01ad98720f3c50d6a8a0ef3108c88 \
+file://iwyu-check-license-header.py;md5=7bdb749831163fbe9232b3cb7186116f"
Quoted 3 lines
meta-oe/recipes-devtools/include-what-you-use/
Quoted 3 lines
meta-oe/recipes-devtools/include-what-you-use/ new file +2
-0+ +SRC_URI = "git://github.com/include-what-you-use/include-what-you-use.git;protocol=https;branch=clang_18
Quoted 4 lines
Quoted 4 lines
"
meta-oe/recipes-devtools/include-what-you-use/ new file +3
-0+ +PV = "0.22+git${SRCPV}" +SRCREV = "377eaef70cdda47368939f4d9beabfabe3f628f0"Quoted 8 lines
meta-oe/recipes-devtools/include-what-you-use/
Quoted 4 lines
meta-oe/recipes-devtools/include-what-you-use/ new file +4
-0+ +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
Quoted 1 line
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.Quoted 16 lines
Quoted 16 lines
meta-oe/recipes-devtools/include-what-you-use/ new file +10
-1+ +inherit cmake python3native + +EXTRA_OECMAKE:append:class-nativesdk = " \ + -DCMAKE_SKIP_RPATH:BOOL=ON \ + " + +FILES:${PN} += "${datadir}/${BPN}" + +BBCLASSEXTEND = "nativesdk" --2.44.1
Quoted 7 lines
Quoted 7 lines
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#111360):
https://lists.openembedded.org/g/openembedded-devel/message/111360
Mute This Topic: https://lists.openembedded.org/mt/107229738/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub[
Quoted 5 lines
Quoted 4 lines
[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Hi Khem,
Quoted 40 lines · Khem Raj
Quoted 38 lines · Christian Eggers
Quoted 1 line · Khem Raj
On Mon, Jul 15, 2024 at 5:18 AM Christian Eggers via
lists.openembedded.org
Quoted 7 lines
Quoted 5 lines · <[email protected]> wrote:
Based on proposal send previously here:
https://lists.yoctoproject.org/g/yocto/topic/recipe_for/83279588This recipe depends on meta-clang, so should it be added to that layer?
Quoted 7 lines
Quoted 7 lines
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
Quoted 7 lines
Quoted 7 lines
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
Quoted 6 lines
Quoted 2 lines
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/
Quoted 8 lines
Quoted 5 lines
/opt/poky/5.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-musleabi/usr/include/c++/13.3.0How can Clang know that the C++ headers are located in the (GCC specific) c++/13.3.0
sub directory?Try adding -stdlib=libstdc++ on clang cmdline
The following seems to work:
include-what-you-use \
-target arm-poky-linux-musleabi \
--sysroot /opt/poky/5.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-musleabi \
-stdlib++-isystem /opt/poky/5.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-musleabi/usr/include/c++/13.3.0/arm-poky-linux-musleabi \
-stdlib++-isystem /opt/poky/5.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-musleabi/usr/include/c++/13.3.0 \
File.cppIs there a way to make this a little bit handier? I would like to avoid hard coding this into my CMake toolchain file.
regards,
Christian
Quoted 55 lines · Christian Eggers
Hi Khem,
Quoted 40 lines · Khem Raj
Quoted 38 lines · Christian Eggers
Quoted 1 line · Khem Raj
On Mon, Jul 15, 2024 at 5:18 AM Christian Eggers via
lists.openembedded.org
Quoted 7 lines
Quoted 5 lines · <[email protected]> wrote:
Based on proposal send previously here:
https://lists.yoctoproject.org/g/yocto/topic/recipe_for/83279588This recipe depends on meta-clang, so should it be added to that layer?
Quoted 7 lines
Quoted 7 lines
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
Quoted 7 lines
Quoted 7 lines
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
Quoted 6 lines
Quoted 2 lines
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/Quoted 8 lines
Quoted 5 lines
/opt/poky/5.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-musleabi/usr/include/c++/13.3.0How can Clang know that the C++ headers are located in the (GCC specific) c++/13.3.0
sub directory?Try adding -stdlib=libstdc++ on clang cmdline
The following seems to work:
Quoted 9 lines
include-what-you-use \ -target arm-poky-linux-musleabi \ --sysroot /opt/poky/5.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-musleabi \ -stdlib++-isystem /opt/poky/5.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-musleabi/usr/include/c++/13.3.0/arm-poky-linux-musleabi \ -stdlib++-isystem /opt/poky/5.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-musleabi/usr/include/c++/13.3.0 \ File.cppIs there a way to make this a little bit handier? I would like to avoid hard coding this into my CMake toolchain file.
Hmm so -stdlib=libstdc++ does not work ?
Quoted 5 lines
regards,
Christian
Hi Khem,
sorry for the delay.
Quoted 63 lines · Khem Raj
Quoted 62 lines · Christian Eggers
Hi Khem,
Quoted 40 lines · Khem Raj
Quoted 38 lines · Christian Eggers
Quoted 1 line · Khem Raj
On Mon, Jul 15, 2024 at 5:18 AM Christian Eggers via
lists.openembedded.org
Quoted 7 lines
Quoted 5 lines · <[email protected]> wrote:
Based on proposal send previously here:
https://lists.yoctoproject.org/g/yocto/topic/recipe_for/83279588This recipe depends on meta-clang, so should it be added to that layer?
Quoted 7 lines
Quoted 7 lines
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
Quoted 7 lines
Quoted 7 lines
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
Quoted 6 lines
Quoted 2 lines
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/Quoted 8 lines
Quoted 5 lines
/opt/poky/5.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-musleabi/usr/include/c++/13.3.0How can Clang know that the C++ headers are located in the (GCC specific) c++/13.3.0
sub directory?Try adding -stdlib=libstdc++ on clang cmdline
The following seems to work:
include-what-you-use \ -target arm-poky-linux-musleabi \ --sysroot /opt/poky/5.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-musleabi \ -stdlib++-isystem /opt/poky/5.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-musleabi/usr/include/c++/13.3.0/arm-poky-linux-musleabi \ -stdlib++-isystem /opt/poky/5.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-musleabi/usr/include/c++/13.3.0 \ File.cpp
Quoted 4 lines
Quoted 2 lines
Is there a way to make this a little bit handier? I would like to avoid hard coding this into my CMake toolchain file.
Hmm so -stdlib=libstdc++ does not work ?
I cannot reproduce what exactly went wrong, but now the following works fine:
include-what-you-use -target arm-poky-linux-musleabi --sysroot /opt/poky/5.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-musleabi test.cpp include-what-you-use -target x86_64-pokysdk-linux --sysroot /opt/orbiter-tiny/5.0.2/sysroots/x86_64-pokysdk-linux test.cpp
So neither '-stdlib=libstdc++' nor '-stdlib++-isystem' is required anymore.
I was also able to integrate this into a CMake project (built with the SDK) by adding the following to my toolchain file:
set(CMAKE_C_INCLUDE_WHAT_YOU_USE include-what-you-use;-target;arm-poky-linux-musleabi;--sysroot;$ENV{SDKTARGETSYSROOT}) set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE include-what-you-use;-target;arm-poky-linux-musleabi;--sysroot;$ENV{SDKTARGETSYSROOT})
The IWYU tool states itself as "experimental software", so the output better should be interpreted by a human. I've tested with an existing code base and got many valuable hints for missing/superfluous #include statements. The results are quite good for std:: C/C++ headers, but other libraries like Boost need further improvements.
Can this recipe be added to meta-clang (due to it's dependencies to libclang/libllvm)?
Quoted 113 lines · Christian Eggers
Hi Khem,
sorry for the delay.
Quoted 1 line · Khem Raj
On Tue, Jul 16, 2024 at 7:57 AM Christian Eggers <[email protected]>
Quoted 6 lines · wrote:
Quoted 6 lines
Hi Khem,
Quoted 1 line · Khem Raj
On Tue, Jul 16, 2024 at 1:08 AM Christian Eggers <[email protected]>
Quoted 8 lines · wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines · Khem Raj
Quoted 1 line
On Mon, Jul 15, 2024 at 5:18 AM Christian Eggers via
lists.openembedded.org
Quoted 4 lines
Quoted 2 lines · <[email protected]> wrote:
Based on proposal send previously here:
https://lists.yoctoproject.org/g/yocto/topic/recipe_for/83279588
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
This recipe depends on meta-clang, so should it be added to
that layer?
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Unfortunately the 'include-what-you-use' (iwyu) tool doesn't
work yet.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Although I have installed nativesdk-clang (via CLANGSDK = "1")
and
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
nativesdk-include-what-you-use packages, the C++ standard
headers are
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
not found:
include-what-you-use
--sysroot=/opt/poky/5.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-musleabi
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
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
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
probably only a beginner mistake. Can Clang use the C++ headers
provided
Quoted 4 lines
Quoted 2 lines
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
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
check a simple program that includes say <iostream> header and
try
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
compiling it
My SDK definitely contains std:: C++ headers for target and
nativesdk. But
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
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/Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
/opt/poky/5.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-musleabi/usr/include/c++/13.3.0Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
How can Clang know that the C++ headers are located in the (GCC
specific)
Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
Quoted 2 lines
c++/13.3.0
sub directory?Try adding -stdlib=libstdc++ on clang cmdline
The following seems to work:
include-what-you-use \ -target arm-poky-linux-musleabi \ --sysroot
/opt/poky/5.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-musleabi\Quoted 1 line
Quoted 1 line
-stdlib++-isystem
/opt/poky/5.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-musleabi/usr/include/c++/13.3.0/arm-poky-linux-musleabi\Quoted 1 line
Quoted 1 line
-stdlib++-isystem
/opt/poky/5.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-musleabi/usr/include/c++/13.3.0\Quoted 3 lines
Quoted 3 lines
File.cpp
Is there a way to make this a little bit handier? I would like to
avoid hard coding this into my CMake toolchain file.
Quoted 3 lines
Quoted 1 line
Hmm so -stdlib=libstdc++ does not work ?
I cannot reproduce what exactly went wrong, but now the following works fine:
include-what-you-use -target arm-poky-linux-musleabi --sysroot
/opt/poky/5.0.2/sysroots/cortexa7t2hf-neon-vfpv4-poky-linux-musleabitest.cpp
include-what-you-use -target x86_64-pokysdk-linux --sysroot/opt/orbiter-tiny/5.0.2/sysroots/x86_64-pokysdk-linuxtest.cppSo neither '-stdlib=libstdc++' nor '-stdlib++-isystem' is required anymore.
I was also able to integrate this into a CMake project (built with the SDK) by adding the following to my toolchain file:
set(CMAKE_C_INCLUDE_WHAT_YOU_USE include-what-you-use;-target;arm-poky-linux-musleabi;--sysroot;$ENV{SDKTARGETSYSROOT}) set(CMAKE_CXX_INCLUDE_WHAT_YOU_USE include-what-you-use;-target;arm-poky-linux-musleabi;--sysroot;$ENV{SDKTARGETSYSROOT})
Quoted 10 lines
The IWYU tool states itself as "experimental software", so the output better should be interpreted by a human. I've tested with an existing code base and got many valuable hints for missing/superfluous #include statements. The results are quite good for std:: C/C++ headers, but other libraries like Boost need further improvements.
Can this recipe be added to meta-clang (due to it's dependencies to libclang/libllvm)?
Yes send a pr to meta-clang