The eBPFs are pre-compiled during the systemd-build with a different
compiler than the cross-compiler used to build systemd itself.
This is either a 'clang-native' or a gcc (bpf-unknown-none) which do
not see the BUILD_CFLAGS set -isystem ${STAGING_INCDIR}. For this the
meson.build file constructing the compiler call had to be patched to
handle this bitbake specific setup.
Signed-off-by: Johannes Schneider <[email protected]>
---
...bitbake-pass-STAGING_INCDIR-to-clang.patch | 41 +++++++++++++++++++
meta/recipes-core/systemd/systemd_255.6.bb | 1 +
2 files changed, 42 insertions(+)
create mode 100644
meta/recipes-core/systemd/systemd/0023-bitbake-pass-STAGING_INCDIR-to-clang.patch
diff --git
a/meta/recipes-core/systemd/systemd/0023-bitbake-pass-STAGING_INCDIR-to-clang.patch
b/meta/recipes-core/systemd/systemd/0023-bitbake-pass-STAGING_INCDIR-to-clang.patch
new file mode 100644
index 0000000000..b907fd79b7
--- /dev/null
+++
b/meta/recipes-core/systemd/systemd/0023-bitbake-pass-STAGING_INCDIR-to-clang.patch
@@ -0,0 +1,41 @@
+From 4f4b3d662e5475b375808cea3a6a90d61b6c9522 Mon Sep 17 00:00:00 2001
+From: Johannes Schneider <[email protected]>
+Date: Sat, 8 Jun 2024 18:19:39 +0200
+Subject: [PATCH] bitbake: pass STAGING_INCDIR to clang
+
+Pass bitbakes STAGING_INCDIR as header searchpath to clang/gcc, where
+it can&should look for the libbpf headers when it compiles the BPFs.
+
+This is "the least ugly hack", compared to other alternatives like for example
+what '-Defi-includedir=...' did (creating an extra option to smuggle in bitbake
+variables).
+
+Ideally the compiler would use the BUILD_CFLAGS set by bitbake, which
+set among other things also the corretc -isystem...; but haven't found
+a good way to do so in meson (yet) :-P
+
+Signed-off-by: Johannes Schneider <[email protected]>
+---
+ meson.build | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index 187e7b216d..dc1a464504 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1746,7 +1746,11 @@ if conf.get('BPF_FRAMEWORK') == 1
+
+ bpf_o_unstripped_cmd += ['-I.']
+
+- if not meson.is_cross_build()
++ if meson.is_cross_build()
++ ## point 'clang'/'gcc' to the bitbake recipe sysroot, to find
the libbpf headers there.
++ staging_incdir = join_paths(meson.source_root(),
'../recipe-sysroot/usr/include')
++ bpf_o_unstripped_cmd += [ '-isystem', staging_incdir ]
++ else
+ target_triplet_cmd = run_command('gcc', '-dumpmachine',
check: false)
+ if target_triplet_cmd.returncode() == 0
+ target_triplet = target_triplet_cmd.stdout().strip()
+--
+2.34.1
+
diff --git a/meta/recipes-core/systemd/systemd_255.6.bb
b/meta/recipes-core/systemd/systemd_255.6.bb
index e70c9c738d..3fd4d5bc5b 100644
--- a/meta/recipes-core/systemd/systemd_255.6.bb
+++ b/meta/recipes-core/systemd/systemd_255.6.bb
@@ -28,6 +28,7 @@ SRC_URI += " \
file://systemd-pager.sh \
file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
file://0008-implment-systemd-sysv-install-for-OE.patch \
+ file://0023-bitbake-pass-STAGING_INCDIR-to-clang.patch \
"
# patches needed by musl
--
2.34.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#200454):
https://lists.openembedded.org/g/openembedded-core/message/200454
Mute This Topic: https://lists.openembedded.org/mt/106572377/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-