From: Jiri Olsa <olsajiri@gmail.com>
To: Shen Jiamin <shen_jiamin@comp.nus.edu.sg>
Cc: bpf@vger.kernel.org, Nathan Chancellor <nathan@kernel.org>
Subject: Re: [PATCH v2] tools/resolve_btfids: Use pkg-config to locate libelf
Date: Thu, 15 Dec 2022 09:29:44 +0100 [thread overview]
Message-ID: <Y5ra+O280ehBxILH@krava> (raw)
In-Reply-To: <20221215044703.400139-1-shen_jiamin@comp.nus.edu.sg>
On Thu, Dec 15, 2022 at 12:47:03PM +0800, Shen Jiamin wrote:
> When libelf was not installed in the standard location, it cannot be
> located by the current building config.
>
> Use pkg-config to help locate libelf in such cases.
>
> Signed-off-by: Shen Jiamin <shen_jiamin@comp.nus.edu.sg>
Acked-by: Jiri Olsa <jolsa@kernel.org>
thanks,
jirka
> ---
> tools/bpf/resolve_btfids/Makefile | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile
> index 19a3112e271a..f7375a119f54 100644
> --- a/tools/bpf/resolve_btfids/Makefile
> +++ b/tools/bpf/resolve_btfids/Makefile
> @@ -56,13 +56,17 @@ $(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(LIBBPF_OU
> DESTDIR=$(LIBBPF_DESTDIR) prefix= EXTRA_CFLAGS="$(CFLAGS)" \
> $(abspath $@) install_headers
>
> +LIBELF_FLAGS := $(shell $(HOSTPKG_CONFIG) libelf --cflags 2>/dev/null)
> +LIBELF_LIBS := $(shell $(HOSTPKG_CONFIG) libelf --libs 2>/dev/null || echo -lelf)
> +
> CFLAGS += -g \
> -I$(srctree)/tools/include \
> -I$(srctree)/tools/include/uapi \
> -I$(LIBBPF_INCLUDE) \
> - -I$(SUBCMD_SRC)
> + -I$(SUBCMD_SRC) \
> + $(LIBELF_FLAGS)
>
> -LIBS = -lelf -lz
> +LIBS = $(LIBELF_LIBS) -lz
>
> export srctree OUTPUT CFLAGS Q
> include $(srctree)/tools/build/Makefile.include
> --
> 2.34.1
next prev parent reply other threads:[~2022-12-15 8:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-15 4:47 [PATCH v2] tools/resolve_btfids: Use pkg-config to locate libelf Shen Jiamin
2022-12-15 8:29 ` Jiri Olsa [this message]
2022-12-15 22:00 ` patchwork-bot+netdevbpf
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=Y5ra+O280ehBxILH@krava \
--to=olsajiri@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=shen_jiamin@comp.nus.edu.sg \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox