Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meson: bpf: propagate 'sysroot' during cross compilation #33427

Merged
merged 1 commit into from
Jun 20, 2024

Conversation

js731ca
Copy link
Contributor

@js731ca js731ca commented Jun 20, 2024

To be able to use resource-control features like RestrictNetworkInterfaces= a set of corresponding eBPFs need to be compiled.

When targeting an embedded platform, dependencies like libbpf (and the bpftool) are compiled separately and place their headers/libraries into a common sysroot which the cross-compiler used to build target binaries - including systemd - usually knows.

But during cross-compilation of systemd, the compiler used to build the eBPF's is a different one ('clang-native' or a gcc: bpf-unknown-none ), and needs to be pointed at the correct include search-path, where the libbpf headers reside.

This can be done by passing the corresponding directory in through the cflags; for example in yocto/bitbake this would work: CFLAGS += "--sysroot=${STAGING_DIR_TARGET}", and have meson.build "propagate" this setting to the eBPF compiler.


related open-embedded submissions:
https://lists.openembedded.org/g/openembedded-core/message/200948
https://lists.openembedded.org/g/openembedded-core/message/200949

During cross-compilation of systemd, the compiler used to build the bpf's needs
to be pointed at the correct include searchpath. Which can be done by passing
the corresponding directory in through the cflags; for example in yocto/bitbake
this would work: CFLAGS += "--sysroot=${STAGING_DIR_TARGET}"

Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
@github-actions github-actions bot added build-system meson please-review PR is ready for (re-)review by a maintainer labels Jun 20, 2024
@yuwata yuwata added good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed and removed please-review PR is ready for (re-)review by a maintainer labels Jun 20, 2024
@yuwata yuwata merged commit b608bf5 into systemd:main Jun 20, 2024
41 of 48 checks passed
@github-actions github-actions bot removed the good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed label Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants