[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BPF in linux-libre

From: John Soo
Subject: Re: BPF in linux-libre
Date: Sun, 14 Jun 2020 08:11:39 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hi Mathieu,

Mathieu Othacehe <> writes:

> Now, it's just a matter of packaging "bcc" and "bpftrace" I guess.

I was working on these yesterday. I keep getting errors that seem to
indicate the linux-libre-headers we have might not be compatible:

Here's my definition:

(define-public bcc
  (let* ((ver "0.14.0")
         (commit (string-append "v" ver)))
      (name "bcc")
      (version ver)
         (method git-fetch)
         (uri (git-reference
               (url "";)
               (commit commit)))
         (file-name (git-file-name name ver))
      (build-system cmake-build-system)
       `(("bison" ,bison)
         ("clang-toolchain" ,clang-toolchain)
         ("flex" ,flex)
         ("libbpf" ,libbpf)
         ("libelf" ,libelf)
         ("linux-libre-headers" ,linux-libre-headers)
         ("python-wrapper" ,python-wrapper)))
       `(#:parallel-build? #f
           "-DLIBBPF_INCLUDE_DIR=" (assoc-ref %build-inputs "libbpf") 
      (home-page "";)
      (synopsis "Tools for BPF on Linux")
       "BCC is a toolkit for creating efficient kernel tracing and
manipulation programs, and includes several useful tools and examples.  It
makes use of extended BPF (Berkeley Packet Filters), formally known as eBPF, a
new feature that was first added to Linux 3.15.  Much of what BCC uses requires
Linux 4.1 and above.")
      (license license:asl2.0))))

I get a lot of errors that certain things are undefined.  I am guessing
the names should be available in the linux headers?

/tmp/guix-build-bcc-0.14.0.drv-0/source/src/cc/libbpf.c:694:58: error: 
‘BPF_PROG_TYPE_EXT’ undeclared (first use in this function); did you mean 
   if (prog_type != BPF_PROG_TYPE_TRACING && prog_type != BPF_PROG_TYPE_EXT)

The bcc github releases seem to indicate that bcc supports kernels up to

I also defined libbpf (included as a submodule) like this:

(define-public libbpf
  (let* ((commit "6a1615c263b679c17ecb292fa897f159e826dc10"))
      (name "libbpf")
      (version "0.0.8")
         (method git-fetch)
         (uri (git-reference
               (url "";)
               (commit commit)))
      (build-system gnu-build-system)
       `(("libelf" ,libelf)
         ("pkg-config" ,pkg-config)
         ("zlib" ,zlib)))
       `(#:tests? #f ; No tests
          (string-append "PREFIX=''")
          (string-append "DESTDIR=" (assoc-ref %outputs "out"))
           "CC=" (assoc-ref %build-inputs "gcc") "/bin/gcc"))
         (modify-phases %standard-phases
           (delete 'configure)
           (add-before 'build 'pre-build
             (lambda* (#:key inputs #:allow-other-keys)
               (substitute* "scripts/"
                 (("/bin/rm" rm)
                  (string-append (assoc-ref inputs "coreutils") rm)))
               (chdir "src")
      (home-page "";)
      (synopsis "BPF CO-RE (Compile Once – Run Everywhere)")
       "Libbpf supports building BPF CO-RE-enabled applications, which, in
contrast to BCC, do not require Clang/LLVM runtime being deployed to target
servers and does not rely on kernel-devel headers being available.")
      (license `(,license:lgpl2.1 ,license:bsd-2)))))

I'm not sure where to go from here.

Thanks for the help!

- John

reply via email to

[Prev in Thread] Current Thread [Next in Thread]