bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Xu <dxu@dxuuu.xyz>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
	andrii@kernel.org,  bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next] bpf, vmtest: Build test_progs and friends as statically linked
Date: Tue, 11 Jul 2023 14:15:35 -0600	[thread overview]
Message-ID: <dm7i55664qqp64gogp2gbfljivgiexckw5pnvljoldtxbk7or2@n6kjeviz23wn> (raw)
In-Reply-To: <8005de2d-5e10-9eef-2a0d-6f15aa681c05@iogearbox.net>

Hi,

On Wed, May 31, 2023 at 09:53:57PM +0200, Daniel Borkmann wrote:
> On 5/31/23 9:02 PM, Andrii Nakryiko wrote:
> > On Fri, May 26, 2023 at 3:47 PM Daniel Borkmann <daniel@iogearbox.net> wrote:
> > > 
> > > Small fix for vmtest.sh that I've been carrying locally for quite a while
> > > now in order to work around the following linker issue:
> > > 
> > >    # ./vmtest.sh -- ./test_progs -t lsm
> > >    [...]
> > >    + ip link set lo up
> > >    + [ -x /etc/rcS.d/S50-startup ]
> > >    + /etc/rcS.d/S50-startup
> > >    ./test_progs -t lsm
> > >    ./test_progs: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by ./test_progs)
> > >    ./test_progs: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./test_progs)
> > >    [    1.356497] ACPI: PM: Preparing to enter system sleep state S5
> > >    [    1.358950] reboot: Power down
> > >    [...]
> > > 
> > > With the specified TRUNNER_LDFLAGS out of vmtest to force static linking
> > > runners like test_progs/test_maps/etc work just fine.
> > 
> > Should we make this a command line option to the vmtest.sh script
> > instead? I, for one, can't even successfully build on my machine with
> > this, probably due to missing some -static library package (though I
> > did install libzstd-static). I'm getting:
> 
> Interesting, in my case it's the other way round, but yeah that could work
> as well.
> 
> Thanks,
> Daniel
> 

I had the same zstd linker error. This hacky change fixes it:

```
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 9706e7e5e698..c0d8809fd002 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -31,7 +31,7 @@ CFLAGS += -g -O0 -rdynamic -Wall -Werror $(GENFLAGS) $(SAN_CFLAGS)    \
          -I$(CURDIR) -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR)          \
          -I$(TOOLSINCDIR) -I$(APIDIR) -I$(OUTPUT)
 LDFLAGS += $(SAN_LDFLAGS)
-LDLIBS += -lelf -lz -lrt -lpthread
+LDLIBS += -lelf -lz -lrt -lpthread -lzstd

 # Silence some warnings when compiled with clang
 ifneq ($(LLVM),)
```

Would be good to get some variant of this patch in.

Thanks,
Daniel

  reply	other threads:[~2023-07-11 20:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-26 22:47 [PATCH bpf-next] bpf, vmtest: Build test_progs and friends as statically linked Daniel Borkmann
2023-05-31 19:02 ` Andrii Nakryiko
2023-05-31 19:53   ` Daniel Borkmann
2023-07-11 20:15     ` Daniel Xu [this message]
2023-07-12 12:38       ` Daniel Borkmann
2023-07-12 16:42         ` Daniel Xu

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=dm7i55664qqp64gogp2gbfljivgiexckw5pnvljoldtxbk7or2@n6kjeviz23wn \
    --to=dxu@dxuuu.xyz \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    /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).