Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #65280 > unrolled thread

libbpf-devel rpm uapi headers

Started byJiri Olsa <jolsa@redhat.com>
First post2019-10-02 20:10 +0200
Last post2019-10-02 22:30 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.debian.kernel


Contents

  libbpf-devel rpm uapi headers Jiri Olsa <jolsa@redhat.com> - 2019-10-02 20:10 +0200
    Re: libbpf-devel rpm uapi headers Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2019-10-02 21:10 +0200
      Re: libbpf-devel rpm uapi headers Jiri Olsa <jolsa@redhat.com> - 2019-10-02 22:30 +0200

#65280 — libbpf-devel rpm uapi headers

FromJiri Olsa <jolsa@redhat.com>
Date2019-10-02 20:10 +0200
Subjectlibbpf-devel rpm uapi headers
Message-ID<yMRey-3t7-15@gated-at.bofh.it>
hi,
we'd like to have bcc linked with libbpf instead of the
github submodule, initial change is discussed in here:
  https://github.com/iovisor/bcc/pull/2535

In order to do that, we need to have access to uapi headers
compatible with libbpf rpm, bcc is attaching and using them
during compilation.

I added them in the fedora spec below (not submitted yet),
so libbpf would carry those headers.

Thoughts? thanks,
jirka


---
Subject: [PATCH] Package uapi headers under /usr/include/bpf/uapi/linux

The full list of files for libbpf-devel is now:

  /usr/include/bpf
  /usr/include/bpf/bpf.h
  /usr/include/bpf/btf.h
  /usr/include/bpf/libbpf.h
  /usr/include/bpf/libbpf_util.h
  /usr/include/bpf/uapi
  /usr/include/bpf/uapi/linux
  /usr/include/bpf/uapi/linux/compiler.h
  /usr/include/bpf/uapi/linux/err.h
  /usr/include/bpf/uapi/linux/filter.h
  /usr/include/bpf/uapi/linux/kernel.h
  /usr/include/bpf/uapi/linux/list.h
  /usr/include/bpf/uapi/linux/overflow.h
  /usr/include/bpf/uapi/linux/ring_buffer.h
  /usr/include/bpf/uapi/linux/types.h
  /usr/include/bpf/xsk.h
  /usr/lib64/libbpf.so
  /usr/lib64/pkgconfig/libbpf.pc
---
 libbpf.spec | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libbpf.spec b/libbpf.spec
index 5d0f29718cac..681800c7f93e 100644
--- a/libbpf.spec
+++ b/libbpf.spec
@@ -4,7 +4,7 @@
 
 Name:           %{githubname}
 Version:        %{githubver}
-Release:        2%{?dist}
+Release:        3%{?dist}
 Summary:        Libbpf library
 
 License:        LGPLv2 or BSD
@@ -48,6 +48,8 @@ developing applications that use %{name}
 
 %install
 %make_install -C ./src %{make_flags}
+install -d -m 755  %{buildroot}/usr/include/bpf/uapi/linux
+cp include/linux/* %{buildroot}/usr/include/bpf/uapi/linux
 
 %files
 %{_libdir}/libbpf.so.%{version}
@@ -62,6 +64,9 @@ developing applications that use %{name}
 %{_libdir}/libbpf.a
 
 %changelog
+* Wed Oct 02 2019 Jiri Olsa <jolsa@redhat.com> - 0.0.3-3
+- Add uapi headers
+
 * Wed Sep 25 2019 Jiri Olsa <jolsa@redhat.com> - 0.0.3-2
 - Fix libelf linking (BZ#1755317)
 
-- 
2.21.0

[toc] | [next] | [standalone]


#65281

FromAlexei Starovoitov <alexei.starovoitov@gmail.com>
Date2019-10-02 21:10 +0200
Message-ID<yMSaB-42n-5@gated-at.bofh.it>
In reply to#65280
On Wed, Oct 02, 2019 at 07:43:31PM +0200, Jiri Olsa wrote:
> hi,
> we'd like to have bcc linked with libbpf instead of the
> github submodule, initial change is discussed in here:
>   https://github.com/iovisor/bcc/pull/2535
> 
> In order to do that, we need to have access to uapi headers
> compatible with libbpf rpm, bcc is attaching and using them
> during compilation.
> 
> I added them in the fedora spec below (not submitted yet),
> so libbpf would carry those headers.
> 
> Thoughts? thanks,

I think it may break a bunch of people who rely on bcc being a single library.
What is the main motiviation to use libbpf as a shared library in libbcc?

I think we can have both options. libbpf as git submodule and as shared.
In practice git submodule is so much simpler to use and a lot less headaches.

[toc] | [prev] | [next] | [standalone]


#65285

FromJiri Olsa <jolsa@redhat.com>
Date2019-10-02 22:30 +0200
Message-ID<yMTq1-4Ig-3@gated-at.bofh.it>
In reply to#65281
On Wed, Oct 02, 2019 at 11:43:17AM -0700, Alexei Starovoitov wrote:
> On Wed, Oct 02, 2019 at 07:43:31PM +0200, Jiri Olsa wrote:
> > hi,
> > we'd like to have bcc linked with libbpf instead of the
> > github submodule, initial change is discussed in here:
> >   https://github.com/iovisor/bcc/pull/2535
> > 
> > In order to do that, we need to have access to uapi headers
> > compatible with libbpf rpm, bcc is attaching and using them
> > during compilation.
> > 
> > I added them in the fedora spec below (not submitted yet),
> > so libbpf would carry those headers.
> > 
> > Thoughts? thanks,
> 
> I think it may break a bunch of people who rely on bcc being a single library.

there's still libbpf.a available so it's still possible

> What is the main motiviation to use libbpf as a shared library in libbcc?

Besides that it's better to share common source of libbpf code,
it also prevents issues when having application that links to
libbpf and libbcc, where you could end up conflicting functions
and segfaults if those 2 libbpf libs are not on the same version.

quote from the github pull request ;-)

bpftrace links to libbcc, which carries libbcc_bpf and if I link
bpftrace with libbpf, the dynamic loader might get consused and
I get crash if those 2 libbpf libs (bcc x bpftrace) are not the
same version

> 
> I think we can have both options. libbpf as git submodule and as shared.
> In practice git submodule is so much simpler to use and a lot less headaches.

that's what the change to bcc suggests.. the build detects libbpf-devel
and if available links with it.. Yonghong suggested we also need uapi
headers so we don't rely on standard kernel headers

jirka

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.kernel


csiph-web