1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
{
lib,
stdenv,
fetchFromGitHub,
rocmUpdateScript,
pkg-config,
texinfo,
bison,
flex,
glibc,
zlib,
zstd,
gmp,
mpfr,
ncurses,
expat,
rocdbgapi,
perl,
python3,
babeltrace,
sourceHighlight,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "rocgdb";
version = "6.3.3";
src = fetchFromGitHub {
owner = "ROCm";
repo = "ROCgdb";
rev = "rocm-${finalAttrs.version}";
hash = "sha256-Z+uk+ViLXgk5hXrIhVHRY0Kly7mktYms7M3o9Tmxv8s=";
};
nativeBuildInputs = [
pkg-config
texinfo # For makeinfo
bison
flex
perl # used in mkinstalldirs script during installPhase
python3
];
buildInputs = [
zlib
zstd
gmp
mpfr
ncurses
expat
rocdbgapi
python3
babeltrace
sourceHighlight
];
configureFlags = [
# Ensure we build the amdgpu target
"--enable-targets=${stdenv.targetPlatform.config},amdgcn-amd-amdhsa"
"--with-amd-dbgapi=yes"
"--with-iconv-path=${glibc.bin}"
"--enable-tui"
"--with-babeltrace=${babeltrace}"
"--with-python=python3"
"--with-system-zlib"
"--with-system-zstd"
"--enable-64-bit-bfd"
"--with-gmp=${gmp.dev}"
"--with-mpfr=${mpfr.dev}"
"--with-expat=${expat}"
# 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-gdbtk"
"--disable-gprofng"
"--disable-shared"
];
postPatch = ''
for file in *; do
if [ -f "$file" ]; then
patchShebangs "$file"
fi
done
'';
# 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
'';
env.CFLAGS = "-Wno-switch -Wno-format-nonliteral -I${zstd.dev}/include -I${zlib.dev}/include -I${expat.dev}/include -I${ncurses.dev}/include";
env.CXXFLAGS = finalAttrs.env.CFLAGS;
passthru.updateScript = rocmUpdateScript {
name = finalAttrs.pname;
inherit (finalAttrs.src) owner;
inherit (finalAttrs.src) repo;
};
meta = with lib; {
description = "ROCm source-level debugger for Linux, based on GDB";
homepage = "https://github.com/ROCm/ROCgdb";
license = licenses.gpl3Plus;
maintainers = teams.rocm.members;
platforms = platforms.linux;
};
})
|