Re: clang 10 for BPF CO-RE

Jesper Dangaard Brouer

On Wed, 11 Mar 2020 10:36:47 -0700
"Andrii Nakryiko" <andrii.nakryiko@...> wrote:

On Wed, Mar 11, 2020 at 10:33 AM <tmayfield@...> wrote:

Hi all,

Finally found the BPF blog and it's been nice to get more
information on using libbpf directly since I don't have a lot of
systems or kernel experience.
Thanks! Glad it was useful.
I assume this is the blog post[1]:
Thanks for writing that Andrii!

For using libbpf directly from C, we also have the XDP-tutorial[2], but
doesn't contain BPF CO-RE examples. And it uses the old style map
defines. We are planning to update/fix that, once LLVM 10 gets more
widely available in distros.


Scanning through the "BCC to libbpf" post, I noticed Andrii calls
for using clang 10. I went to look at llvm releases and only saw
clang/llvm 9 (as of September 2019). Is clang 10 just built from
For kernel/libbpf development we do build Clang from sources, but you
can install it from packages as well. See, there
are packages for Clang 10 and even Clang 11 and they are updated
Let me give you the manual compile recipe (that I got from Eelco):

git clone
cd llvm-project
mkdir -p llvm/build/install
cd llvm/build
cmake -G "Ninja" -DLLVM_TARGETS_TO_BUILD="BPF;X86" \
ninja && ninja install
export PATH=$PWD/install/bin:$PATH

Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat

Join to automatically receive all group messages.