From 28bd9e7394072b838850f1a1076eeea229451b37 Mon Sep 17 00:00:00 2001 From: Emily Date: Sun, 20 Apr 2025 18:15:55 +0100 Subject: [PATCH] =?UTF-8?q?valgrind:=20remove=20Darwin=E2=80=90related=20d?= =?UTF-8?q?ead=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This has been broken on Darwin since 2020 and depends on deprecated stubs. Best to remove it until someone figures out how to get it working again than spend effort tidying up dead code. --- .../tools/analysis/valgrind/default.nix | 59 ++++--------------- pkgs/top-level/all-packages.nix | 4 +- 2 files changed, 14 insertions(+), 49 deletions(-) diff --git a/pkgs/development/tools/analysis/valgrind/default.nix b/pkgs/development/tools/analysis/valgrind/default.nix index 3f2d2d38e757..c180de124d6b 100644 --- a/pkgs/development/tools/analysis/valgrind/default.nix +++ b/pkgs/development/tools/analysis/valgrind/default.nix @@ -6,9 +6,6 @@ autoreconfHook, perl, gdb, - cctools, - xnu, - bootstrap_cmds, writeScript, }: @@ -56,15 +53,10 @@ stdenv.mkDerivation rec { # GDB is needed to provide a sane default for `--db-command'. # Perl is needed for `callgrind_{annotate,control}'. - buildInputs = - [ - gdb - perl - ] - ++ lib.optionals (stdenv.hostPlatform.isDarwin) [ - bootstrap_cmds - xnu - ]; + buildInputs = [ + gdb + perl + ]; # Perl is also a native build input. nativeBuildInputs = [ @@ -75,40 +67,11 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; separateDebugInfo = stdenv.hostPlatform.isLinux; - preConfigure = - lib.optionalString stdenv.hostPlatform.isFreeBSD '' - substituteInPlace configure --replace-fail '`uname -r`' ${stdenv.cc.libc.version}- - '' - + lib.optionalString stdenv.hostPlatform.isDarwin ( - let - OSRELEASE = '' - $(awk -F '"' '/#define OSRELEASE/{ print $2 }' \ - <${xnu}/Library/Frameworks/Kernel.framework/Headers/libkern/version.h)''; - in - '' - echo "Don't derive our xnu version using uname -r." - substituteInPlace configure --replace "uname -r" "echo ${OSRELEASE}" + preConfigure = lib.optionalString stdenv.hostPlatform.isFreeBSD '' + substituteInPlace configure --replace-fail '`uname -r`' ${stdenv.cc.libc.version}- + ''; - # Apple's GCC doesn't recognize `-arch' (as of version 4.2.1, build 5666). - echo "getting rid of the \`-arch' GCC option..." - find -name Makefile\* -exec \ - sed -i {} -e's/DARWIN\(.*\)-arch [^ ]\+/DARWIN\1/g' \; - - sed -i coregrind/link_tool_exe_darwin.in \ - -e 's/^my \$archstr = .*/my $archstr = "x86_64";/g' - - substituteInPlace coregrind/m_debuginfo/readmacho.c \ - --replace /usr/bin/dsymutil ${stdenv.cc.bintools.bintools}/bin/dsymutil - - echo "substitute hardcoded /usr/bin/ld with ${cctools}/bin/ld" - substituteInPlace coregrind/link_tool_exe_darwin.in \ - --replace /usr/bin/ld ${cctools}/bin/ld - '' - ); - - configureFlags = - lib.optional stdenv.hostPlatform.isx86_64 "--enable-only64bit" - ++ lib.optional stdenv.hostPlatform.isDarwin "--with-xcodedir=${xnu}/include"; + configureFlags = lib.optional stdenv.hostPlatform.isx86_64 "--enable-only64bit"; doCheck = true; @@ -157,6 +120,10 @@ stdenv.mkDerivation rec { darwin ++ freebsd ++ illumos ++ linux ); badPlatforms = [ lib.systems.inspect.platformPatterns.isStatic ]; - broken = stdenv.hostPlatform.isDarwin; # https://hydra.nixos.org/build/128521440/nixlog/2 + # See: + # + # Darwin‐specific derivation logic has been removed, check the + # history if you want to fix this. + broken = stdenv.hostPlatform.isDarwin; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 50eca52b28f5..94046eda17ad 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8175,9 +8175,7 @@ with pkgs; jdk = jdk11; }; - valgrind = callPackage ../development/tools/analysis/valgrind { - inherit (buildPackages.darwin) xnu bootstrap_cmds; - }; + valgrind = callPackage ../development/tools/analysis/valgrind { }; valgrind-light = (res.valgrind.override { gdb = null; }).overrideAttrs (oldAttrs: { meta = oldAttrs.meta // { description = "${oldAttrs.meta.description} (without GDB)";