From: Namhyung Kim <namhyung@kernel.org>
To: Leo Yan <leo.yan@arm.com>
Cc: Quentin Monnet <qmo@kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>, Nick Terrell <terrelln@fb.com>,
bpf@vger.kernel.org, linux-perf-users@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] bpftool: Fix failure with static linkage
Date: Wed, 4 Dec 2024 13:36:32 -0800 [thread overview]
Message-ID: <Z1DLYCha0-o1RWkF@google.com> (raw)
In-Reply-To: <20241204213059.2792453-1-leo.yan@arm.com>
Hi Leo,
On Wed, Dec 04, 2024 at 09:30:59PM +0000, Leo Yan wrote:
> When building perf with static linkage:
>
> make O=/build LDFLAGS="-static" -C tools/perf VF=1 DEBUG=1
> ...
> LINK /build/util/bpf_skel/.tmp/bootstrap/bpftool
> /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/libelf.a(elf_compress.o): in function `__libelf_compress':
> (.text+0x113): undefined reference to `ZSTD_createCCtx'
> /usr/bin/ld: (.text+0x2a9): undefined reference to `ZSTD_compressStream2'
> /usr/bin/ld: (.text+0x2b4): undefined reference to `ZSTD_isError'
> /usr/bin/ld: (.text+0x2db): undefined reference to `ZSTD_freeCCtx'
> /usr/bin/ld: (.text+0x5a0): undefined reference to `ZSTD_compressStream2'
> /usr/bin/ld: (.text+0x5ab): undefined reference to `ZSTD_isError'
> /usr/bin/ld: (.text+0x6b9): undefined reference to `ZSTD_freeCCtx'
> /usr/bin/ld: (.text+0x835): undefined reference to `ZSTD_freeCCtx'
> /usr/bin/ld: (.text+0x86f): undefined reference to `ZSTD_freeCCtx'
> /usr/bin/ld: (.text+0x91b): undefined reference to `ZSTD_freeCCtx'
> /usr/bin/ld: (.text+0xa12): undefined reference to `ZSTD_freeCCtx'
> /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/libelf.a(elf_compress.o): in function `__libelf_decompress':
> (.text+0xbfc): undefined reference to `ZSTD_decompress'
> /usr/bin/ld: (.text+0xc04): undefined reference to `ZSTD_isError'
> /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/libelf.a(elf_compress.o): in function `__libelf_decompress_elf':
> (.text+0xd45): undefined reference to `ZSTD_decompress'
> /usr/bin/ld: (.text+0xd4d): undefined reference to `ZSTD_isError'
> collect2: error: ld returned 1 exit status
>
> Building bpftool with static linkage also fails with the same errors:
>
> make O=/build -C tools/bpf/bpftool/ V=1
>
> To fix the issue, explicitly link libzstd.
I was about to report exactly the same. :)
>
> Signed-off-by: Leo Yan <leo.yan@arm.com>
Tested-by: Namhyung Kim <namhyung@kernel.org>
Thanks,
Namhyung
> ---
> tools/bpf/bpftool/Makefile | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
> index a4263dfb5e03..65b2671941e0 100644
> --- a/tools/bpf/bpftool/Makefile
> +++ b/tools/bpf/bpftool/Makefile
> @@ -130,8 +130,8 @@ include $(FEATURES_DUMP)
> endif
> endif
>
> -LIBS = $(LIBBPF) -lelf -lz
> -LIBS_BOOTSTRAP = $(LIBBPF_BOOTSTRAP) -lelf -lz
> +LIBS = $(LIBBPF) -lelf -lz -lzstd
> +LIBS_BOOTSTRAP = $(LIBBPF_BOOTSTRAP) -lelf -lz -lzstd
> ifeq ($(feature-libcap), 1)
> CFLAGS += -DUSE_LIBCAP
> LIBS += -lcap
> --
> 2.34.1
>
next prev parent reply other threads:[~2024-12-04 21:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-04 21:30 [PATCH] bpftool: Fix failure with static linkage Leo Yan
2024-12-04 21:36 ` Namhyung Kim [this message]
2024-12-04 22:08 ` Quentin Monnet
2024-12-04 22:25 ` Namhyung Kim
2024-12-04 22:55 ` Quentin Monnet
2024-12-05 10:23 ` Leo Yan
2024-12-05 10:58 ` Quentin Monnet
2024-12-10 18:26 ` Andrii Nakryiko
2024-12-10 20:19 ` Leo Yan
2024-12-05 19:24 ` Stanislav Fomichev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z1DLYCha0-o1RWkF@google.com \
--to=namhyung@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=leo.yan@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=qmo@kernel.org \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=terrelln@fb.com \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.