All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: "Daniel T. Lee" <danieltimlee@gmail.com>,
	Alexei Starovoitov <ast@kernel.org>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] libbpf: fix samples/bpf build failure due to undefined UINT32_MAX
Date: Thu, 25 Apr 2019 23:40:45 +0200	[thread overview]
Message-ID: <4326e9a6-3a97-d110-5953-6b6f9844b1ef@iogearbox.net> (raw)
In-Reply-To: <20190423202456.1477-1-danieltimlee@gmail.com>

On 04/23/2019 10:24 PM, Daniel T. Lee wrote:
> Currently, building bpf samples will cause the following error.
> 
>     ./tools/lib/bpf/bpf.h:132:27: error: 'UINT32_MAX' undeclared here (not in a function) ..
>      #define BPF_LOG_BUF_SIZE (UINT32_MAX >> 8) /* verifier maximum in kernels <= 5.1 */
>                                ^
>     ./samples/bpf/bpf_load.h:31:25: note: in expansion of macro 'BPF_LOG_BUF_SIZE'
>      extern char bpf_log_buf[BPF_LOG_BUF_SIZE];
>                              ^~~~~~~~~~~~~~~~
> 
> Due to commit 4519efa6f8ea ("libbpf: fix BPF_LOG_BUF_SIZE off-by-one error")
> hard-coded size of BPF_LOG_BUF_SIZE has been replaced with UINT32_MAX which is
> defined in <stdint.h> header.
> 
> Even with this change, bpf selftests are running fine since these are built
> with clang and it includes header(-idirafter) from clang/6.0.0/include.
> (it has <stdint.h>)
> 
>     clang -I. -I./include/uapi -I../../../include/uapi -idirafter /usr/local/include -idirafter /usr/include \
>     -idirafter /usr/lib/llvm-6.0/lib/clang/6.0.0/include -idirafter /usr/include/x86_64-linux-gnu \
>     -Wno-compare-distinct-pointer-types -O2 -target bpf -emit-llvm -c progs/test_sysctl_prog.c -o - | \
>     llc -march=bpf -mcpu=generic  -filetype=obj -o /linux/tools/testing/selftests/bpf/test_sysctl_prog.o
> 
> But bpf samples are compiled with GCC, and it only searches and includes
> headers declared at the target file. As '#include <stdint.h>' hasn't been
> declared in tools/lib/bpf/bpf.h, it causes build failure of bpf samples.
> 
>     gcc -Wp,-MD,./samples/bpf/.sockex3_user.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes \
>     -O2 -fomit-frame-pointer -std=gnu89 -I./usr/include -I./tools/lib/ -I./tools/testing/selftests/bpf/ \
>     -I./tools/  lib/ -I./tools/include -I./tools/perf -c -o ./samples/bpf/sockex3_user.o ./samples/bpf/sockex3_user.c;
> 
> This commit add declaration of '#include <stdint.h>' to tools/lib/bpf/bpf.h
> to fix this problem.
> 
> Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>

Applied, thanks.

      parent reply	other threads:[~2019-04-25 21:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-23 20:24 [PATCH] libbpf: fix samples/bpf build failure due to undefined UINT32_MAX Daniel T. Lee
2019-04-23 23:26 ` Y Song
2019-04-24  1:01   ` Daniel T. Lee
2019-04-24  6:04     ` Y Song
2019-04-25 21:40 ` Daniel Borkmann [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=4326e9a6-3a97-d110-5953-6b6f9844b1ef@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=ast@kernel.org \
    --cc=danieltimlee@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.