From 19b8b523c995e37e6b2c9cc1ea46b280301f91e1 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Wed, 24 Aug 2022 07:23:07 +0100 Subject: [PATCH] linuxPackages.perf: use binutils-2.38 for linux before 5.19 Without the change perf build fails on binutils-2.39 due to API change: util/annotate.c: In function 'symbol__disassemble_bpf': util/annotate.c:1765:9: error: too few arguments to function 'init_disassemble_info' 1765 | init_disassemble_info(&info, s, | ^~~~~~~~~~~~~~~~~~~~~ --- pkgs/os-specific/linux/kernel/perf/default.nix | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkgs/os-specific/linux/kernel/perf/default.nix b/pkgs/os-specific/linux/kernel/perf/default.nix index d481eea7e753..dcb1c4e9dcc1 100644 --- a/pkgs/os-specific/linux/kernel/perf/default.nix +++ b/pkgs/os-specific/linux/kernel/perf/default.nix @@ -1,6 +1,6 @@ { lib, stdenv, fetchpatch, kernel, elfutils, python2, python3, perl, newt, slang, asciidoc, xmlto, makeWrapper , docbook_xsl, docbook_xml_dtd_45, libxslt, flex, bison, pkg-config, libunwind, binutils-unwrapped -, libiberty, audit, libbfd, libopcodes, openssl, systemtap, numactl +, libiberty, audit, libbfd, libbfd_2_38, libopcodes, libopcodes_2_38, openssl, systemtap, numactl , zlib , withGtk ? false, gtk2 , withZstd ? true, zstd @@ -45,9 +45,12 @@ stdenv.mkDerivation { flex bison libiberty audit makeWrapper pkg-config python3 ]; buildInputs = [ - elfutils newt slang libunwind libbfd zlib openssl systemtap.stapBuild numactl - libopcodes python3 perl - ] ++ lib.optional withGtk gtk2 + elfutils newt slang libunwind zlib openssl systemtap.stapBuild numactl + python3 perl + ] ++ (if (lib.versionAtLeast kernel.version "5.19") + then [ libbfd libopcodes ] + else [ libbfd_2_38 libopcodes_2_38 ]) + ++ lib.optional withGtk gtk2 ++ (if (lib.versionAtLeast kernel.version "4.19") then [ python3 ] else [ python2 ]) ++ lib.optional withZstd zstd ++ lib.optional withLibcap libcap;