2022-04-25 10:29:15

by Dominique Martinet

[permalink] [raw]
Subject: [PATCH 0/4] tools/bpf: allow building with musl

Hi,

I'd like to build bpftool on alpine linux, which is musl based.

There are a few incompatibilities with it, I've commented on each patch
when I could think of alternative solutions.

I've tested the patch on an x86_64 debian testing with no problem, so
didn't obviously break glibc builds, and the binaries built for alpine
seem to work on aarch64 as well.


Dominique Martinet (4):
tools/runqslower: musl compat: explicitly link with libargp if found
tools/bpf: musl compat: do not use DEFFILEMODE
tools/bpf: musl compat: replace nftw with FTW_ACTIONRETVAL
tools/bpf: replace sys/fcntl.h by fcntl.h

tools/bpf/bpf_jit_disasm.c | 2 +-
tools/bpf/bpftool/perf.c | 115 +++++++++++++++--------------
tools/bpf/bpftool/tracelog.c | 2 +-
tools/bpf/runqslower/Makefile | 30 +++++++-
tools/build/feature/Makefile | 4 +
tools/build/feature/test-all.c | 4 +
tools/build/feature/test-libargp.c | 14 ++++
7 files changed, 111 insertions(+), 60 deletions(-)
create mode 100644 tools/build/feature/test-libargp.c

--
2.35.1


2022-04-25 11:10:19

by Dominique Martinet

[permalink] [raw]
Subject: [PATCH 4/4] tools/bpf: replace sys/fcntl.h by fcntl.h

musl does not like including sys/fcntl.h directly:
1 | #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h>

Signed-off-by: Dominique Martinet <[email protected]>
---
tools/bpf/bpftool/tracelog.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/bpf/bpftool/tracelog.c b/tools/bpf/bpftool/tracelog.c
index e80a5c79b38f..bf1f02212797 100644
--- a/tools/bpf/bpftool/tracelog.c
+++ b/tools/bpf/bpftool/tracelog.c
@@ -9,7 +9,7 @@
#include <string.h>
#include <unistd.h>
#include <linux/magic.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <sys/vfs.h>

#include "main.h"
--
2.35.1

2022-04-25 23:54:43

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH 0/4] tools/bpf: allow building with musl

Hello:

This series was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <[email protected]>:

On Sun, 24 Apr 2022 14:10:18 +0900 you wrote:
> Hi,
>
> I'd like to build bpftool on alpine linux, which is musl based.
>
> There are a few incompatibilities with it, I've commented on each patch
> when I could think of alternative solutions.
>
> [...]

Here is the summary with links:
- [1/4] tools/bpf/runqslower: musl compat: explicitly link with libargp if found
(no matching commit)
- [2/4] tools/bpf: musl compat: do not use DEFFILEMODE
(no matching commit)
- [3/4] tools/bpf: musl compat: replace nftw with FTW_ACTIONRETVAL
https://git.kernel.org/bpf/bpf-next/c/93bc2e9e943d
- [4/4] tools/bpf: replace sys/fcntl.h by fcntl.h
https://git.kernel.org/bpf/bpf-next/c/246bdfa52f33

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html


2022-04-26 09:32:55

by Quentin Monnet

[permalink] [raw]
Subject: Re: [PATCH 4/4] tools/bpf: replace sys/fcntl.h by fcntl.h

On Sun, 24 Apr 2022 at 06:11, Dominique Martinet <[email protected]> wrote:
>
> musl does not like including sys/fcntl.h directly:
> 1 | #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h>
>
> Signed-off-by: Dominique Martinet <[email protected]>

Acked-by: Quentin Monnet <[email protected]>