Skip to content

Commit

Permalink
libbpf-tools: Fix build dependence for parallel builds
Browse files Browse the repository at this point in the history
Add LIBBPF_OBJ dependence to `%.o'.

When libbpf-tools built in parallel (with `make -j`) sometimes
`map_helpers.o' is built before `libbpf.a' causing build error:

  $ make -j8 -C libbpf-tools BPFTOOL=/usr/sbin/bpftool
  ...
  make: Entering directory '/usr/src/RPM/BUILD/bcc-0.19.0/libbpf-tools'
    CC       map_helpers.o
  In file included from map_helpers.c:7:
  ./map_helpers.h:6:10: fatal error: 'bpf/bpf.h' file not found
	   ^~~~~~~~~~~
  1 error generated.
  ...
  make: Leaving directory '/usr/src/RPM/BUILD/bcc-0.19.0/libbpf-tools'
    INSTALL  bpf.h libbpf.h btf.h xsk.h libbpf_util.h bpf_helpers.h bpf_helper_defs.h bpf_tracing.h bpf_endian.h bpf_core_read.h libbpf_common.h
  ...
    INSTALL  libbpf.a
  error: Bad exit status from /usr/src/tmp/rpm-tmp.63536 (%build)

Fixes: iovisor#3412
Signed-off-by: Vitaly Chikunov <[email protected]>
  • Loading branch information
vt-alt authored and yonghong-song committed May 14, 2021
1 parent f129fda commit 0eef179
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libbpf-tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ $(APPS): %: $(OUTPUT)/%.o $(LIBBPF_OBJ) $(COMMON_OBJ) | $(OUTPUT)

$(patsubst %,$(OUTPUT)/%.o,$(APPS)): %.o: %.skel.h

$(OUTPUT)/%.o: %.c $(wildcard %.h) | $(OUTPUT)
$(OUTPUT)/%.o: %.c $(wildcard %.h) $(LIBBPF_OBJ) | $(OUTPUT)
$(call msg,CC,$@)
$(Q)$(CC) $(CFLAGS) $(INCLUDES) -c $(filter %.c,$^) -o $@

Expand Down

0 comments on commit 0eef179

Please sign in to comment.