Skip to content

Commit

Permalink
meson: Add scx_lib dep to gen_bpf_o
Browse files Browse the repository at this point in the history
This commit introduces a dependency on scx_lib in gen_bpf_o.

Without this dependency the build fails intermittently with the
following error:

```
FAILED: scheds/c/scx_pair.p/scx_pair.bpf.skel.h scheds/c/scx_pair.p/scx_pair.bpf.subskel.h
/home/frelon/src/scx/meson-scripts/bpftool_build_skel /usr/sbin/bpftool scheds/c/scx_pair.p/scx_pair.bpf.o scheds/c/scx_pair.p/scx_pair.bpf.skel.h scheds/c/scx_pair.p/scx_pair.bpf.subskel.h /home/frelon/src/scx/build/lib/lib
libbpf: failed to get ELF header for /home/frelon/src/scx/build/lib/lib.bpf.o: invalid `Elf' handle
/home/frelon/src/scx/meson-scripts/bpftool_build_skel: line 25: 3400506 Segmentation fault      (core dumped) "$bpftool" gen object "$stem".l1o "$input" "$lib".bpf.o
```

Signed-off-by: Fredrik Lönnegren <[email protected]>
  • Loading branch information
frelon committed Dec 7, 2024
1 parent 22d45e6 commit a72c24e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,15 @@ bpf_includes = ['-I', join_paths(meson.current_source_dir(), 'scheds/include'),
'-I', join_paths(meson.current_source_dir(), 'scheds/include/bpf-compat'),
'-I', join_paths(meson.current_source_dir(), 'lib/include'),]

lib_objs = []
subdir('lib')

#
# Generators to build BPF skel file for C schedulers.
#
gen_bpf_o = generator(bpf_clang,
output: '@[email protected]',
depends: [libbpf],
depends: [libbpf, scx_lib],
arguments: [bpf_base_cflags, '-target', 'bpf', libbpf_c_headers, bpf_includes,
'-c', '@INPUT@', '-o', '@OUTPUT@'])

Expand Down Expand Up @@ -459,9 +462,6 @@ if enable_stress
endif
endif

lib_objs = []
subdir('lib')

thread_dep = dependency('threads')

subdir('scheds')
Expand Down

0 comments on commit a72c24e

Please sign in to comment.