From: Lorenz Bauer <lmb@cloudflare.com>
To: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: bpf <bpf@vger.kernel.org>, Networking <netdev@vger.kernel.org>,
gor@linux.ibm.com, heiko.carstens@de.ibm.com
Subject: Re: [PATCH bpf] tools/bpf: fix bpftool build with OUTPUT set
Date: Tue, 23 Jul 2019 13:59:01 +0100 [thread overview]
Message-ID: <CACAyw9-qZQ4Affu6w1VpyH0HjP9WBBuArdzW6Sdp9cNzWvjCsQ@mail.gmail.com> (raw)
In-Reply-To: <20190718142041.83342-1-iii@linux.ibm.com>
Hi Ilya,
Thanks for your patch! I tried it but had problems with
cross-compilation. Not sure if this is related to the patch or not
though, I haven't had the time to follow up.
Best
Lorenz
On Thu, 18 Jul 2019 at 15:20, Ilya Leoshkevich <iii@linux.ibm.com> wrote:
>
> Hi Lorenz,
>
> I've been using the following patch for quite some time now.
> Please let me know if it works for you.
>
> Best regards,
> Ilya
>
> ---
>
> When OUTPUT is set, bpftool and libbpf put their objects into the same
> directory, and since some of them have the same names, the collision
> happens.
>
> Fix by invoking libbpf build in a manner similar to $(call descend) -
> descend itself cannot be used, since libbpf is a sibling, and not a
> child, of bpftool.
>
> Also, don't link bpftool with libbpf.a twice.
>
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
> tools/bpf/bpftool/Makefile | 17 ++++++-----------
> 1 file changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
> index a7afea4dec47..2cbc3c166f44 100644
> --- a/tools/bpf/bpftool/Makefile
> +++ b/tools/bpf/bpftool/Makefile
> @@ -15,23 +15,18 @@ else
> endif
>
> BPF_DIR = $(srctree)/tools/lib/bpf/
> -
> -ifneq ($(OUTPUT),)
> - BPF_PATH = $(OUTPUT)
> -else
> - BPF_PATH = $(BPF_DIR)
> -endif
> -
> -LIBBPF = $(BPF_PATH)libbpf.a
> +BPF_PATH = $(objtree)/tools/lib/bpf
> +LIBBPF = $(BPF_PATH)/libbpf.a
>
> BPFTOOL_VERSION := $(shell make --no-print-directory -sC ../../.. kernelversion)
>
> $(LIBBPF): FORCE
> - $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(OUTPUT) $(OUTPUT)libbpf.a
> + $(Q)mkdir -p $(BPF_PATH)
> + $(Q)$(MAKE) $(COMMAND_O) subdir=tools/lib/bpf -C $(BPF_DIR) $(LIBBPF)
>
> $(LIBBPF)-clean:
> $(call QUIET_CLEAN, libbpf)
> - $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(OUTPUT) clean >/dev/null
> + $(Q)$(MAKE) $(COMMAND_O) subdir=tools/lib/bpf -C $(BPF_DIR) clean >/dev/null
>
> prefix ?= /usr/local
> bash_compdir ?= /usr/share/bash-completion/completions
> @@ -112,7 +107,7 @@ $(OUTPUT)disasm.o: $(srctree)/kernel/bpf/disasm.c
> $(QUIET_CC)$(COMPILE.c) -MMD -o $@ $<
>
> $(OUTPUT)bpftool: $(OBJS) $(LIBBPF)
> - $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
> + $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
>
> $(OUTPUT)%.o: %.c
> $(QUIET_CC)$(COMPILE.c) -MMD -o $@ $<
> --
> 2.21.0
>
--
Lorenz Bauer | Systems Engineer
6th Floor, County Hall/The Riverside Building, SE1 7PB, UK
www.cloudflare.com
prev parent reply other threads:[~2019-07-23 12:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-18 13:59 Building bpftool with OUTPUT set breaks Lorenz Bauer
2019-07-18 14:20 ` [PATCH bpf] tools/bpf: fix bpftool build with OUTPUT set Ilya Leoshkevich
2019-07-18 18:51 ` Jakub Kicinski
2019-07-19 13:12 ` Ilya Leoshkevich
2019-07-19 18:17 ` Jakub Kicinski
2019-07-23 15:14 ` Ilya Leoshkevich
2019-07-23 12:59 ` Lorenz Bauer [this message]
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=CACAyw9-qZQ4Affu6w1VpyH0HjP9WBBuArdzW6Sdp9cNzWvjCsQ@mail.gmail.com \
--to=lmb@cloudflare.com \
--cc=bpf@vger.kernel.org \
--cc=gor@linux.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=iii@linux.ibm.com \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).