BPF List
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: andrii@kernel.org
Cc: ast@kernel.org, bpf@vger.kernel.org, Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH] bpftool: Allow building statically
Date: Thu, 17 Feb 2022 14:04:35 +0200	[thread overview]
Message-ID: <20220217120435.2245447-1-nborisov@suse.com> (raw)

Sometime it can be useful to haul around a statically built version of
bpftool. Simply add support for passing STATIC=1 while building to build
the tool statically.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---

Currently the bpftool being distributed as part of libbpf-tools under bcc project
is dynamically built on a system using GLIBC 2.28, this makes the tool unusable on
ubuntu 18.04 for example. Perhaps after this patch has landed the bpftool in bcc
can be turned into a static binary.

 tools/bpf/bpftool/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index 83369f55df61..835621e215e4 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -13,6 +13,10 @@ else
   Q = @
 endif

+ifeq ($(STATIC),1)
+	CFLAGS += --static
+endif
+
 BPF_DIR = $(srctree)/tools/lib/bpf

 ifneq ($(OUTPUT),)
--
2.25.1


             reply	other threads:[~2022-02-17 12:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17 12:04 Nikolay Borisov [this message]
2022-02-18 16:08 ` [PATCH] bpftool: Allow building statically Quentin Monnet
2022-02-18 16:14   ` Nikolay Borisov
2022-02-18 16:33     ` Quentin Monnet
2022-02-18 19:58       ` Daniel Borkmann
2022-02-18 20:00         ` Quentin Monnet

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=20220217120435.2245447-1-nborisov@suse.com \
    --to=nborisov@suse.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@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