From 47363ef04f20560adabc13dddf1bea28afe33dd8 Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Mon, 21 Mar 2022 12:33:01 -0500 Subject: [PATCH] gdb: fix w/musl (#164766) * gdb: fix on musl, sys/termios.h -> termios.h * gdb: grab upstream patch to fix w/musl Fixes instances of PAGESIZE/PAGE_SIZE that conflict with header-provided definitions. I was concerned about stability (IIRC version in these can change?) but already risking that with the gcc-12 patch, so this is probably okay. Stale/unstable URL's are especially important to avoid on less commonly used combinations such as w/musl, but also don't want to bloat the tree :). Risk is low, as this will be included in next update. --- pkgs/development/tools/misc/gdb/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/development/tools/misc/gdb/default.nix b/pkgs/development/tools/misc/gdb/default.nix index 5bb5bc0652fe..f21808b1bf70 100644 --- a/pkgs/development/tools/misc/gdb/default.nix +++ b/pkgs/development/tools/misc/gdb/default.nix @@ -37,6 +37,8 @@ stdenv.mkDerivation rec { postPatch = if stdenv.isDarwin then '' substituteInPlace gdb/darwin-nat.c \ --replace '#include "bfd/mach-o.h"' '#include "mach-o.h"' + '' else if stdenv.hostPlatform.isMusl then '' + substituteInPlace sim/ppc/emul_unix.c --replace sys/termios.h termios.h '' else null; patches = [ @@ -50,7 +52,11 @@ stdenv.mkDerivation rec { }) ] ++ lib.optionals stdenv.isDarwin [ ./darwin-target-match.patch - ]; + ] ++ lib.optional stdenv.hostPlatform.isMusl (fetchpatch { + name = "musl-fix-pagesize-page_size.patch"; + url = "https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=fd0975b96b16d96010dce439af9620d3dfb65426"; + hash = "sha256-M3U7uIIFJnYu0g8/sMLJPhm02q7cGOi6pLjgsUUjeKI="; + }); nativeBuildInputs = [ pkg-config texinfo perl setupDebugInfoDirs ];