From 98c224e981344bb075adbc20486a3978c1fb1433 Mon Sep 17 00:00:00 2001 From: Mahe Tardy Date: Fri, 16 Aug 2024 12:54:26 +0200 Subject: [PATCH] Dockerfile: fix a static linking issue with bpftool When bumping the builder image to Ubuntu 24.04, the static build of bpftool started to fail. We cannot use EXTRA_LDFLAGS unfortunately and need to mofiy the LIBS and LIBS_BOOTSTRAP Makefile variables. Maybe we can upstream this fix later. Signed-off-by: Mahe Tardy --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 7ae25fa8990..0bfc0453578 100644 --- a/Dockerfile +++ b/Dockerfile @@ -56,6 +56,8 @@ RUN if [ $BUILDARCH != $TARGETARCH ]; \ # v7.3.0 ENV BPFTOOL_REV="687e7f06f2ee104ed6515ec3a9816af77bfa7a17" RUN git clone https://github.com/libbpf/bpftool.git . && git checkout ${BPFTOOL_REV} && git submodule update --init --recursive +# From Ubuntu 24.04 builder image, libzstd must be added at the end of LIBS and LIBS_BOOTSTRAP to compile statically +RUN sed -i 's/\(LIBS = $(LIBBPF) -lelf -lz\)/\1 -lzstd/; s/\(LIBS_BOOTSTRAP = $(LIBBPF_BOOTSTRAP) -lelf -lz\)/\1 -lzstd/' src/Makefile RUN if [ $BUILDARCH != $TARGETARCH ]; \ then make -C src EXTRA_CFLAGS=--static CC=aarch64-linux-gnu-gcc -j $(nproc) && aarch64-linux-gnu-strip src/bpftool; \ else make -C src EXTRA_CFLAGS=--static -j $(nproc) && strip src/bpftool; fi