]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: fix missing failure if bpf-framework was enabled
authorDominique Martinet <asmadeus@codewreck.org>
Sat, 20 Jul 2024 11:38:37 +0000 (20:38 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Sat, 20 Jul 2024 13:59:34 +0000 (15:59 +0200)
If building with clang and clang does not support bpf, then enabling
-Dbpf-framework=enabled would silently drop the feature (even printing
bpf-framework: enabled in the meson build recap, and no message anywhere
that'd hint at the failure!)

This is unexpected, so add check to fail hard in this case.

All other code paths (gcc, missing bpftool) properly check for the
option, but it is not as easy for a custom command so check explicitly

meson.build

index 3893a9fabefe76b436a01d8a1562e9b717e2a121..e0bbb6a9086dc9e7ede77c4d9910c88b14246f3f 100644 (file)
@@ -1102,6 +1102,9 @@ else
                         # Check if 'clang -target bpf' is supported.
                         clang_supports_bpf = run_command(clang, '-target', 'bpf', '--print-supported-cpus', check : false).returncode() == 0
                 endif
+                if bpf_framework.enabled() and not clang_supports_bpf
+                        error('bpf-framework was enabled but clang does not support bpf')
+                endif
         elif bpf_compiler == 'gcc'
                 bpf_gcc = find_program('bpf-gcc',
                                        'bpf-none-gcc',