From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id sz+AEBF0Al8fCQAA0tVLHw (envelope-from ) for ; Mon, 06 Jul 2020 00:45:05 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id StfgBBF0Al/WOgAAbx9fmQ (envelope-from ) for ; Mon, 06 Jul 2020 00:45:05 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id CC4679403C6 for ; Mon, 6 Jul 2020 00:45:03 +0000 (UTC) Received: from localhost ([::1]:54918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jsFFl-0000n3-Ka for larch@yhetil.org; Sun, 05 Jul 2020 20:45:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jsFFd-0000mu-R4 for help-guix@gnu.org; Sun, 05 Jul 2020 20:44:53 -0400 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]:38018) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jsFFY-00025L-7J for help-guix@gnu.org; Sun, 05 Jul 2020 20:44:53 -0400 Received: by mail-pj1-x1043.google.com with SMTP id k5so6676164pjg.3 for ; Sun, 05 Jul 2020 17:44:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=asu-edu.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=hWfMYrP1etwxIkMtQrz9ecbFf6Tm7P+Yl1oCWxMVbgg=; b=M1KGpDcsVTpzNhG4wyAnxsyAZ9aqAW3mBEBnlfdTk1rjOzZy2hNjD4Vir9UgeMgEUg Fo0XF6hhvoz5LNbrxz2iG+EkuCKd/xHXj0PN4i1JixRKXR0iC7UpzVm4GUMAhPJJv3kz U8UTt7+ltKz3nxuozQ8PzRO/Iu2oFHKDfqtchmEEQ7ewhxD866LApskeCJpL/f0gu3r7 oXmFS0dSqkzt8sWNRIF6XnC9G9MJgdxhmWklSY+akVycjB3jBAFyfYvbaaZbo/35f/uo QL9vOdLNgCMssXfRj845JY2rsy08hSoAP7si0+DMoVIfabWADBy9AV9p3hdqhEAbATqd szJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=hWfMYrP1etwxIkMtQrz9ecbFf6Tm7P+Yl1oCWxMVbgg=; b=qtEg8diPnILIHqAmpBktnJjidvMGQJiPAQeYz+GebabHoFFiABbvTWkNqeTQWIQ215 dyQ6fsyuZqRDwH6IEYT4q+4cLZ7RBDYWB41RiyX5KdwK+to3N30FC1mTJygXU69gdLB8 oj58BtsvgCs+k3Ekt9d9q1TMn7AnhZDx6pAIBJjW7id2NJTRdym7OUMdP3m0eZG0lmQB mwJKqs4zbSpbs1wiS4RUbyItJjpu9LnNwvDyN09COJeJoXb9ajB16bx/uJ9dI+CQDTN+ aV4vf0tru5HAV5wF+XAMZHjV2d+Fl+bsqtq/SUczxC3I0gvgE7ZdLN/L0ERLZWrXDtAF T96w== X-Gm-Message-State: AOAM530TC90NsZlOXCfUcU6C6+w+oa2PfIbNL5Fn8BkKIwY6YYscCp4g IXgroULeQ7qDbKn4sFINHGELXtOYR5E= X-Google-Smtp-Source: ABdhPJwxCz4qGf7lJayOw6IPbLT+xJstzoN5bfqWFaxmcsgSEI6qSTgr9NGPkG+zrlg1KkQmy4+8qQ== X-Received: by 2002:a17:90a:338a:: with SMTP id n10mr52342924pjb.50.1593996285783; Sun, 05 Jul 2020 17:44:45 -0700 (PDT) Received: from ecenter ([2600:1700:83b0:8bd0::59c]) by smtp.gmail.com with ESMTPSA id c132sm16951095pfb.112.2020.07.05.17.44.44 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 05 Jul 2020 17:44:44 -0700 (PDT) From: John Soo To: Mathieu Othacehe Subject: Re: BPF in linux-libre References: <44046537-51AD-4BD7-8442-41738C4D8C98@asu.edu> <87lfkqknla.fsf@gnu.org> <87h7vdd6ms.fsf@asu.edu> <87wo46uhdr.fsf@gnu.org> <87zh8wph7h.fsf@asu.edu> <87wo3uxfrq.fsf@gnu.org> <871rlsegf2.fsf@asu.edu> <87h7umjruz.fsf@gnu.org> Date: Sun, 05 Jul 2020 17:44:41 -0700 In-Reply-To: <87h7umjruz.fsf@gnu.org> (Mathieu Othacehe's message of "Sun, 05 Jul 2020 10:20:04 +0200") Message-ID: <87zh8dlbeu.fsf@asu.edu> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::1043; envelope-from=jsoo1@asu.edu; helo=mail-pj1-x1043.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Help Guix Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=asu-edu.20150623.gappssmtp.com header.s=20150623 header.b=M1KGpDcs; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=asu.edu (policy=none); spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-Spam-Score: -1.11 X-TUID: hTWk7mphwsuz --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Mathieu, I attached an updated series. I think I fixed up the lint errors. Pardon me. >> +(define-public libbpf >> + (let* ((commit "6a1615c263b679c17ecb292fa897f159e826dc10")) > Why using a specific commit? > The "0.0.9" is out there :) I updated the packages where it was appropriate. bcc also had an available update, oops. >> + (source >> + (origin >> + (method git-fetch) >> + (uri (git-reference >> + (url "https://github.com/libbpf/libbpf") >> + (commit commit))) >=20 > (commit (string-append "v" version)) should work fine. > + ("pkg-config" ,pkg-config) > This should be a native-input, don't forget to run the linter :) Done, also I made flex and bison native inputs where appropriate. >> + (string-append "PREFIX=3D''") >> + (string-append "DESTDIR=3D" (assoc-ref %outputs "out")) >> + (string-append >> + "CC=3D" (assoc-ref %build-inputs "gcc") "/bin/gcc")) >=20 > This will put libraries in "lib64" directory which is not desired. You > can set LIBDIR to "/lib" to avoid that. Done, thank you. >> + (chdir "src") >=20 > I'm not sure this is needed. I tried without and it failed. I looked at the libbpf build guide and it says to cd src. I wish I could remove it, too. >> + #t))))) >> + (home-page "https://github.com/libbpf/libbpf") >> + (synopsis "BPF CO-RE (Compile Once =E2=80=93 Run Everywhere)") >> + (description >> + "Libbpf supports building BPF CO-RE-enabled applications, which,= in >> +contrast to BCC, do not require Clang/LLVM runtime being deployed to ta= rget >> +servers and does not rely on kernel-devel headers being available.") >=20 > "kernel-devel" is more Debian specific I think. I'm also not sure that > the "Clang deploying" things applied well to Guix. I think I tidied up the description to match the Guix situation. What do you think now? >> +(define-public linux-libre-with-bpf >> + (make-linux-libre* linux-libre-5.4-version >> + linux-libre-5.4-source >> + '("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux" >> "riscv64-linux") >> + #:extra-version "bpf" >> + #:configuration-file kernel-config >> + #:extra-options >> + (append %bpf-extra-linux-options >> + %default-extra-linux-options))) >> + > > What would be the drawbacks of enabling BPF in the default linux-libre > kernel? I could see it being a useful default. BPF seems like a nice technology but I am making these patches to experiment with it myself. Because I haven't used it much I can't really speak on the pros of making it default. Other than my gut feeling that seems like something that should be opted into rather than opting out of I have no strong feelings on including it by default. The only other downside I see is that putting in the default might make the linux definitions less composable. The way it is now, one can assemble a (mostly) bpf-capable system from the pieces in gnu/packages/linux.scm. That said, I think there are a few more missing pieces to get full functionality. Running the example bpftrace scripts gives errors like this: open(/sys/kernel/debug/tracing/uprobe_events): No such file or directory I think that means the operating system definition might need to specify more file systems but I can't seem to work out which ones are required and where to specify them. My first guess is that it would need to be debugfs and mounted in initramfs? I am not sure. Thanks for your feedback! - John --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-gnu-Add-libbpf.patch Content-Transfer-Encoding: quoted-printable >From 7f077c98a2328c43a5041a9461a44299a6b1d9ec Mon Sep 17 00:00:00 2001 From: John Soo Date: Sat, 13 Jun 2020 14:53:50 -0700 Subject: [PATCH 1/5] gnu: Add libbpf. * gnu/packages/linux.scm (libbpf): New variable. --- gnu/packages/linux.scm | 49 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index b508e1809c..9a7cf73c0d 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -45,6 +45,7 @@ ;;; Copyright =C2=A9 2020 Jan (janneke) Nieuwenhuizen ;;; Copyright =C2=A9 2020 Brice Waegeneire ;;; Copyright =C2=A9 2020 Morgan Smith +;;; Copyright =C2=A9 2020 John Soo ;;; ;;; This file is part of GNU Guix. ;;; @@ -7139,3 +7140,51 @@ cache data store that is used by network file system= s such as @code{AFS} and @code{NFS} to cache data locally on disk. The content of the cache is persistent over reboots.") (license license:gpl2+))) + +(define-public libbpf + (let* ((revision "1")) + (package + (name "libbpf") + (version "0.0.9") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/libbpf/libbpf") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "18l0gff7nm841mwhr7bc7x863xcyvwh58zl7mc0amnsjqlbrvqg7")))) + (build-system gnu-build-system) + (native-inputs + `(("pkg-config" ,pkg-config))) + (inputs + `(("libelf" ,libelf) + ("zlib" ,zlib))) + (arguments + `(#:tests? #f ; No tests + #:make-flags + (list + (string-append "PREFIX=3D''") + (string-append "DESTDIR=3D" (assoc-ref %outputs "out")) + (string-append "LIBDIR=3D/lib") + (string-append + "CC=3D" (assoc-ref %build-inputs "gcc") "/bin/gcc")) + #:phases + (modify-phases %standard-phases + (delete 'configure) + (add-before 'build 'pre-build + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "scripts/check-reallocarray.sh" + (("/bin/rm" rm) + (string-append (assoc-ref inputs "coreutils") rm))) + (chdir "src") + #t))))) + (home-page "https://github.com/libbpf/libbpf") + (synopsis "BPF CO-RE (Compile Once =E2=80=93 Run Everywhere)") + (description + "Libbpf supports building BPF CO-RE-enabled applications, which, in +contrast to BCC, do not require the Clang/LLVM runtime or linux kernel +headers.") + (license `(,license:lgpl2.1 ,license:bsd-2))))) --=20 2.27.0 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-gnu-Add-bpf-extra-linux-options.patch >From 4225b08298bf62d008e46b14d14ac5aee717ef27 Mon Sep 17 00:00:00 2001 From: John Soo Date: Sat, 13 Jun 2020 22:52:55 -0700 Subject: [PATCH 2/5] gnu: Add %bpf-extra-linux-options. * gnu/packages/linux (%bpf-extra-linux-options): New variable. --- gnu/packages/linux.scm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 9a7cf73c0d..126d969e65 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -619,6 +619,30 @@ for ARCH and optionally VARIANT, or #f if there is no such configuration." ("CONFIG_CIFS" . m) ("CONFIG_9P_FS" . m))) +;; See https://github.com/iovisor/bcc/blob/master/INSTALL.md#kernel-configuration +(define %bpf-extra-linux-options + `(;; Needed for probes + ("CONFIG_UPROBE_EVENTS" . #t) + ("CONFIG_KPROBE_EVENTS" . #t) + ;; kheaders module also helpful for tracing + ("CONFIG_IKHEADERS" . #t) + ("CONFIG_BPF" . #t) + ("CONFIG_BPF_SYSCALL" . #t) + ("CONFIG_BPF_JIT_ALWAYS_ON" . #t) + ;; optional, for tc filters + ("CONFIG_NET_CLS_BPF" . m) + ;; optional, for tc actions + ("CONFIG_NET_ACT_BPF" . m) + ("CONFIG_BPF_JIT" . #t) + ;; for Linux kernel versions 4.1 through 4.6 + ;; ("CONFIG_HAVE_BPF_JIT" . y) + ;; for Linux kernel versions 4.7 and later + ("CONFIG_HAVE_EBPF_JIT" . #t) + ;; optional, for kprobes + ("CONFIG_BPF_EVENTS" . #t) + ;; kheaders module + ("CONFIG_IKHEADERS" . #t))) + (define (config->string options) (string-join (map (match-lambda ((option . 'm) -- 2.27.0 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0003-gnu-Add-linux-libre-with-bpf.patch >From 1c360ce60dba1d30b7c02e974e37cfe3cbb9c936 Mon Sep 17 00:00:00 2001 From: John Soo Date: Sat, 13 Jun 2020 22:54:24 -0700 Subject: [PATCH 3/5] gnu: Add linux-libre-with-bpf. * gnu/packages/linux.scm (linux-libre-with-bpf): New variable. --- gnu/packages/linux.scm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 126d969e65..8a70a78e64 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -75,6 +75,7 @@ #:use-module (gnu packages bison) #:use-module (gnu packages calendar) #:use-module (gnu packages check) + #:use-module (gnu packages cpio) #:use-module (gnu packages crypto) #:use-module (gnu packages cryptsetup) #:use-module (gnu packages compression) @@ -7165,6 +7166,21 @@ cache data store that is used by network file systems such as @code{AFS} and persistent over reboots.") (license license:gpl2+))) +(define-public linux-libre-with-bpf + (let ((base-linux-libre + (make-linux-libre* + linux-libre-5.4-version + linux-libre-5.4-source + '("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux" "riscv64-linux") + #:extra-version "bpf" + #:configuration-file kernel-config + #:extra-options + (append %bpf-extra-linux-options + %default-extra-linux-options)))) + (package + (inherit base-linux-libre) + (inputs `(("cpio" ,cpio) ,@(package-inputs base-linux-libre)))))) + (define-public libbpf (let* ((revision "1")) (package -- 2.27.0 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0004-gnu-Add-bcc.patch >From a15d37f1dc4a422daac986cce2dce9008ea66540 Mon Sep 17 00:00:00 2001 From: John Soo Date: Sat, 13 Jun 2020 23:16:11 -0700 Subject: [PATCH 4/5] gnu: Add bcc. * gnu/packages/linux.scm (bcc): New variable. --- gnu/packages/linux.scm | 65 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 8a70a78e64..0c1cc77041 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -98,6 +98,8 @@ #:use-module (gnu packages haskell-xyz) #:use-module (gnu packages libunwind) #:use-module (gnu packages libusb) + #:use-module (gnu packages llvm) + #:use-module (gnu packages lua) #:use-module (gnu packages man) #:use-module (gnu packages maths) #:use-module (gnu packages multiprecision) @@ -132,6 +134,7 @@ #:use-module (gnu packages rsync) #:use-module (gnu packages selinux) #:use-module (gnu packages swig) + #:use-module (gnu packages version-control) #:use-module (guix build-system cmake) #:use-module (guix build-system gnu) #:use-module (guix build-system go) @@ -7228,3 +7231,65 @@ persistent over reboots.") contrast to BCC, do not require the Clang/LLVM runtime or linux kernel headers.") (license `(,license:lgpl2.1 ,license:bsd-2))))) + +(define-public bcc + (package + (name "bcc") + (version "0.15.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/iovisor/bcc") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1d5j9zanffa1c7lpi5fcrdlx1n7hy86xl82fam2xqr0s41q4ipxw")))) + (build-system cmake-build-system) + (native-inputs + `(("bison" ,bison) + ("flex" ,flex))) + (inputs + `(;; TODO: package optional integrations + ;; ("arping" ,argping) + ;; ("netperf" ,netperf) + ;; ("iperf" ,iperf) or ("iperf3" ,iperf3) + ("clang-toolchain" ,clang-toolchain) + ;; FIXME: Timestamp some other way. + ("git" ,git) + ("libbpf" ,(package-source libbpf)) + ;; LibElf required but libelf does not contain + ;; archives, only object files. + ;; https://github.com/iovisor/bcc/issues/504 + ("elfutils" ,elfutils) + ("linux-libre-headers" ,linux-libre-headers) + ("luajit" ,luajit) + ("python-wrapper" ,python-wrapper))) + (arguments + `(;; Tests all require sudo and a "standard" file heirarchy + #:tests? #f + ;; LIBBPF_INCLUDE_DIR should work with the output of libbpf - + ;; i.e. ,libbpf instead of ,(package-source libbpf) in inputs + ;; but it seems there could be a bug + ;; #:configure-flags + ;; (list + ;; (string-append + ;; "-DLIBBPF_INCLUDE_DIR=" + ;; (assoc-ref %build-inputs "libbpf") "/include")) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'copy-libbpf + (lambda* (#:key inputs #:allow-other-keys) + (delete-file-recursively "src/cc/libbpf") + (copy-recursively + (assoc-ref inputs "libbpf") "src/cc/libbpf")))))) + (home-page "https://github.com/iovisor/bcc") + (synopsis "Tools for BPF on Linux") + (description + "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))) -- 2.27.0 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0005-gnu-Add-bpftrace.patch >From c808920c5f8575079cf8d442cb84a1fb1905c13d Mon Sep 17 00:00:00 2001 From: John Soo Date: Sat, 13 Jun 2020 23:16:56 -0700 Subject: [PATCH 5/5] gnu: Add bpftrace. * gnu/packages/linux.scm (bpftrace): New variable. * gnu/packages/patches/bpftrace-disable-bfd-disasm.patch: Disable bfd disassembly for bpftrace. * gnu/local.mk (dist_patch_DATA): Add bpftrace-disable-bfd-disasm.patch. --- gnu/local.mk | 1 + gnu/packages/linux.scm | 48 +++++++++++++++++++ .../patches/bpftrace-disable-bfd-disasm.patch | 15 ++++++ 3 files changed, 64 insertions(+) create mode 100644 gnu/packages/patches/bpftrace-disable-bfd-disasm.patch diff --git a/gnu/local.mk b/gnu/local.mk index 9a691525a2..ad12fc5181 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -818,6 +818,7 @@ dist_patch_DATA = \ %D%/packages/patches/bitcoin-core-python-compat.patch \ %D%/packages/patches/blender-2.79-newer-ffmpeg.patch \ %D%/packages/patches/blender-2.79-python-3.7-fix.patch \ + %D%/packages/patches/bpftrace-disable-bfd-disasm.patch \ %D%/packages/patches/busybox-1.31.1-fix-build-with-glibc-2.31.patch \ %D%/packages/patches/byobu-writable-status.patch \ %D%/packages/patches/calibre-no-updates-dialog.patch \ diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 0c1cc77041..b6d69badfe 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -7293,3 +7293,51 @@ 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))) + +(define-public bpftrace + (package + (name "bpftrace") + (version "0.10.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/iovisor/bpftrace") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "023ardywbw5w8815j2ny9rrp2xlpxndqaa7v2njjm8109p7ilsdn")) + (patches (search-patches "bpftrace-disable-bfd-disasm.patch")))) + (build-system cmake-build-system) + (native-inputs + `(("bison" ,bison) + ("flex" ,flex))) + (inputs + `(("bcc" ,bcc) + ("clang-toolchain" ,clang-toolchain) + ("elfutils" ,elfutils) + ;; FIXME: Tests require googletest but clone repository + ;; ("googletest" ,googletest) + ("libbpf" ,libbpf) + ("linux-libre-headers" ,linux-libre-headers))) + (arguments + `(#:tests? #f ; FIXME: Enable when googletest from guix is used + #:configure-flags + '(;; FIXME: Make tests not clone the googletest repository + "-DBUILD_TESTING=OFF" + ;; FIXME: libbfd misses some link dependencies + ;; When fixed, remove patch + "-DHAVE_BFD_DISASM=OFF"))) + (home-page "https://github.com/iovisor/bpftrace") + (synopsis "High-level tracing language for Linux eBPF") + (description + "bpftrace is a high-level tracing language for Linux enhanced Berkeley +Packet Filter (eBPF) available in recent Linux kernels (4.x). bpftrace uses +LLVM as a backend to compile scripts to BPF-bytecode and makes use of BCC for +interacting with the Linux BPF system, as well as existing Linux tracing +capabilities: kernel dynamic tracing (kprobes), user-level dynamic +tracing (uprobes), and tracepoints. The bpftrace language is inspired by awk +and C, and predecessor tracers such as DTrace and SystemTap. bpftrace was +created by Alastair Robertson.") + (license license:asl2.0))) diff --git a/gnu/packages/patches/bpftrace-disable-bfd-disasm.patch b/gnu/packages/patches/bpftrace-disable-bfd-disasm.patch new file mode 100644 index 0000000000..8565d8d851 --- /dev/null +++ b/gnu/packages/patches/bpftrace-disable-bfd-disasm.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e89a6a9..a594786 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -126,10 +126,6 @@ find_package(LibBpf) + find_package(LibBfd) + find_package(LibOpcodes) + +-if(${LIBBFD_FOUND} AND ${LIBOPCODES_FOUND}) +- set(HAVE_BFD_DISASM TRUE) +-endif() +- + include(CheckIncludeFile) + check_include_file("sys/sdt.h" HAVE_SYSTEMTAP_SYS_SDT_H) + -- 2.27.0 --=-=-=--