Skip to content

Commit

Permalink
fix(build): add include to 3rdparty libbpf
Browse files Browse the repository at this point in the history
An issue appears when we try to compile libbpfgo on an older kernel that
doesn't have the XDP_FLAGS_REPLACE defined in
/usr/include/linux/if_link.h. To overcome this, it is necessary to
include the directory of libbpf under 3rdparty during the compilation,
since install_uapi_headers doesn't install if_link.h.
  • Loading branch information
rscampos committed Jul 15, 2024
1 parent 73c0323 commit c8f76d1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ ARCH ?= $(shell uname -m | sed 's/x86_64/amd64/g; s/aarch64/arm64/g')
# libbpf

LIBBPF_SRC = $(abspath ./libbpf/src)
LIBBPF_INCLUDE_UAPI = $(abspath ./libbpf/include/uapi)
LIBBPF_OBJ = $(abspath ./$(OUTPUT)/libbpf.a)
LIBBPF_OBJDIR = $(abspath ./$(OUTPUT)/libbpf)
LIBBPF_DESTDIR = $(abspath ./$(OUTPUT))
Expand All @@ -33,7 +34,7 @@ LDFLAGS =

# golang

CGO_CFLAGS_STATIC = "-I$(abspath $(OUTPUT))"
CGO_CFLAGS_STATIC = "-I$(abspath $(OUTPUT)) -I$(LIBBPF_INCLUDE_UAPI)"
CGO_LDFLAGS_STATIC = "$(shell PKG_CONFIG_PATH=$(LIBBPF_OBJDIR) $(PKGCONFIG) --static --libs libbpf)"
CGO_EXTLDFLAGS_STATIC = '-w -extldflags "-static"'

Expand Down

0 comments on commit c8f76d1

Please sign in to comment.