From 2eeec259f833a9193c1205b46a528414b784bf49 Mon Sep 17 00:00:00 2001 From: Lancelot SIX Date: Mon, 6 May 2024 22:08:55 +0100 Subject: [PATCH 1/2] rocmPackages.rocgdb: Build with amdgpu support The currnt rocgdb package is built without amdgpu uspport (which requires the rocdbgapi library). Fix this, and do other improvements over the default configuration. --- pkgs/development/rocm-modules/6/default.nix | 3 +- .../rocm-modules/6/rocgdb/default.nix | 50 ++++++++++++++++++- 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/pkgs/development/rocm-modules/6/default.nix b/pkgs/development/rocm-modules/6/default.nix index e74df33a7bfb..4d10ea244044 100644 --- a/pkgs/development/rocm-modules/6/default.nix +++ b/pkgs/development/rocm-modules/6/default.nix @@ -115,8 +115,7 @@ in rec { }; rocgdb = callPackage ./rocgdb { - inherit rocmUpdateScript; - elfutils = elfutils.override { enableDebuginfod = true; }; + inherit rocmUpdateScript rocdbgapi; stdenv = llvm.rocmClangStdenv; }; diff --git a/pkgs/development/rocm-modules/6/rocgdb/default.nix b/pkgs/development/rocm-modules/6/rocgdb/default.nix index 919b3e70f6e0..fd155ab09c6f 100644 --- a/pkgs/development/rocm-modules/6/rocgdb/default.nix +++ b/pkgs/development/rocm-modules/6/rocgdb/default.nix @@ -6,11 +6,16 @@ , texinfo , bison , flex +, glibc , zlib -, elfutils , gmp +, mpfr , ncurses , expat +, rocdbgapi +, python3 +, babeltrace +, sourceHighlight }: stdenv.mkDerivation (finalAttrs: { @@ -33,12 +38,53 @@ stdenv.mkDerivation (finalAttrs: { buildInputs = [ zlib - elfutils gmp + mpfr ncurses expat + rocdbgapi + python3 + babeltrace + sourceHighlight ]; + configureFlags = [ + # Ensure we build the amdgpu traget + "--enable-targets=${stdenv.targetPlatform.config},amdgcn-amd-amdhsa" + "--with-amd-dbgapi=yes" + + "--with-iconv-path=${glibc.bin}" + "--enable-tui" + "--with-babeltrace" + "--with-python=python3" + "--with-system-zlib" + "--enable-64-bit-bfd" + "--with-gmp=${gmp.dev}" + "--with-mpfr=${mpfr.dev}" + "--with-expat" + "--with-libexpat-prefix=${expat.dev}" + + # So the installed binary is called "rocgdb" instead on plain "gdb" + "--program-prefix=roc" + + # Disable building many components not used or incompatible with the amdgcn target + "--disable-sim" + "--disable-gdbserver" + "--disable-ld" + "--disable-gas" + "--disable-gdbserver" + "--disable-sim" + "--disable-gdbtk" + "--disable-gprofng" + "--disable-shared" + ]; + + # The source directory for ROCgdb (based on upstream GDB) contains multiple project + # of GNU’s toolchain (binutils and onther), we only need to install the GDB part. + installPhase = '' + make install-gdb + ''; + # `-Wno-format-nonliteral` doesn't work env.NIX_CFLAGS_COMPILE = "-Wno-error=format-security"; From 65e47ee45a9b399b3953f6994b13f57ef20eaa9b Mon Sep 17 00:00:00 2001 From: Lancelot SIX Date: Mon, 6 May 2024 22:11:11 +0100 Subject: [PATCH 2/2] rocmPackckages.rocgdb: Fix license Fix the lincense information for ROCgdb. The appropriate license is GPL3 or above. --- pkgs/development/rocm-modules/6/rocgdb/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/rocm-modules/6/rocgdb/default.nix b/pkgs/development/rocm-modules/6/rocgdb/default.nix index fd155ab09c6f..2112c6cf0210 100644 --- a/pkgs/development/rocm-modules/6/rocgdb/default.nix +++ b/pkgs/development/rocm-modules/6/rocgdb/default.nix @@ -97,7 +97,7 @@ stdenv.mkDerivation (finalAttrs: { meta = with lib; { description = "ROCm source-level debugger for Linux, based on GDB"; homepage = "https://github.com/ROCm/ROCgdb"; - license = with licenses; [ gpl2 gpl3 bsd3 ]; + license = licenses.gpl3Plus; maintainers = teams.rocm.members; platforms = platforms.linux; broken = versionAtLeast finalAttrs.version "7.0.0";