From: James Hilliard Date: Mon, 21 Jul 2025 19:04:49 +0000 (-0600) Subject: meson: prepend sys_root to bpf isystem X-Git-Tag: v258-rc1~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28575ac014194d0040e38db3e95edc5fb8b4b96b;p=thirdparty%2Fsystemd.git meson: prepend sys_root to bpf isystem These sort of absolute include paths are generally unsafe when cross compiling. --- diff --git a/meson.build b/meson.build index c2ced35c66d..c5c08928f88 100644 --- a/meson.build +++ b/meson.build @@ -1775,11 +1775,21 @@ if conf.get('BPF_FRAMEWORK') == 1 target_triplet_cmd = run_command('gcc', '-print-multiarch', check: false) endif if target_triplet_cmd.returncode() == 0 + sysroot = meson.get_external_property('sys_root', '/') target_triplet = target_triplet_cmd.stdout().strip() - bpf_o_unstripped_cmd += [ - '-isystem', - '/usr/include/@0@'.format(target_triplet) - ] + target_include_dir = sysroot / 'usr' / 'include' + target_triple_include_dir = target_include_dir / target_triplet + isystem_dir = '' + if fs.is_dir(target_triple_include_dir) + isystem_dir = target_triple_include_dir + elif fs.is_dir(target_include_dir) + isystem_dir = target_include_dir + endif + if isystem_dir != '' + bpf_o_unstripped_cmd += [ + '-isystem', isystem_dir + ] + endif endif bpf_o_unstripped_cmd += [