You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While i have already provided the gdb/gdbserver-15 statically compiled binaries for you, some people might want to compile it to a different architecture (without our build scripts), or compile a newer version of gdb in the future :). The rest of the file contains a documentation of the compilation process, in order to help you out.
3
+
While we have already provided the gdb/gdbserver-15 statically compiled binaries for you, some people might want to compile it without our build scripts, or compile a newer version of gdb in the future :).
4
+
This rest of the file contains a documentation of the compilation process, in order to help you out.
4
5
5
-
## <VARAIBLES> in the script
6
+
NOTE: The compilation guide describes the compilation process in order to create a minimal-working version of gdb. Our build-scripts also provides further capabilites to gdb, such as python and xml support, which are not documented in this file.
6
7
7
-
When specifying the compilation dir throughout the compilation process (specified as <COMPILATION_DIR_PATH> in this file), DO NOT use relative pathing, or bash characters such as `~`. They will not get parsed correctly! Instead, use absolute paths only.
8
+
## <VARAIBLES> In this file
9
+
10
+
Environment variables are denoted by <...> throughout this file.
11
+
12
+
Please note that when specifying a compilation dir throughout the compilation process (via the <COMPILATION_DIR_PATH> environment variable), DO NOT use relative pathing, or special bash characters such as `~`. Relative pathing / special bash characters will not get parsed correctly!
13
+
14
+
Instead, always use absolute paths.
8
15
9
16
Examples to the <VARIABLES> throughout the script:
- glibc version: 2.39-0ubuntu8.3 (NOTE: When i compiled gdb-15 using an older glibc, such as the one i had in my ubuntu-20.04 machine, i received a segfault in gdb...).
23
+
- glibc version: 2.39-0ubuntu8.3 (NOTE: When i compiled gdb-15 using an older glibc, such as the one i had in my ubuntu-20.04 machine, i received a segfault in gdb, so the libc version is important!).
17
24
18
25
# Compiling gdb statically to the host platform
19
26
20
27
## 1) Compiling iconv
21
28
22
29
While compiling iconv is not a must, the libc-provided iconv (a utility to convert between encodings) may fail on different architectures,
23
-
at least in my experiance. Thus, I recommended using a custom libiconv and compiling it into gdb.
30
+
at least in my experience.
31
+
Thus, I recommended using a custom libiconv and compiling it into gdb.
24
32
25
33
Download the source from https://github.com/roboticslibrary/libiconv.git
34
+
26
35
Make sure to check out to a stable tag (in my case - v1.17).
27
36
28
37
Work according to the following steps:
29
-
I) run `./gitsub.sh pull`
30
-
II) run `./autogen.sh` to create the configure script from configure.sh.
31
-
III) create a build dir (e.g build), and then cd into it.
32
-
IV) run `../configure --enable-static`
33
-
V) run `cp -r ./include ./lib/.libs/`
34
-
VI) run `mkdir ./lib/.libs/lib/`
35
-
VII) run `cp ./lib/.libs/libiconv.a ./lib/.libs/lib/`
38
+
1. run `./gitsub.sh pull`
39
+
2. run `./autogen.sh` to create the configure script from configure.sh.
40
+
3. create a build dir (e.g build), and then cd into it.
41
+
4. run `../configure --enable-static`
42
+
5. run `cp -r ./include ./lib/.libs/`
43
+
6. run `mkdir ./lib/.libs/lib/`
44
+
7. run `cp ./lib/.libs/libiconv.a ./lib/.libs/lib/`
36
45
37
46
## 2) Compiling gdb
38
47
39
-
Clone gdb from sourceware - https://sourceware.org/git/binutils-gdb.git.
40
-
I checked out to the 15.2 tag.
48
+
Clone gdb from from my forked respository - https://github.com/guyush1/binutils-gdb/tree/gdb-static.
49
+
50
+
Make sure to check out to the **gdb-static** branch - this branch contains all of the changes i had to do to the build system in order for it to compile gdb statically.
41
51
42
52
Work according to the following steps:
43
-
I) Apply my patches (gdb_static.patch). If you are not on the exact tag i used (15.2) - you might need to apply them manually, and change some stuff.
44
-
II) create a build dir.
45
-
III) run `../configure --enable-static --with-static-standard-libraries --disable-tui --disable-inprocess-agent --with-libiconv-prefix=<COMPILATION_DIR_PATH>/lib/.libs/ --with-libiconv-type=static`
46
-
IV) run `make all-gdb -j$(nproc)` - for gdbserver, run `make all-gdbserver -j$(nproc)`.
53
+
1. create a build dir.
54
+
2. run `../configure --enable-static --with-static-standard-libraries --disable-tui --disable-inprocess-agent --with-libiconv-prefix=<COMPILATION_DIR_PATH>/lib/.libs/ --with-libiconv-type=static`
55
+
3. run `make all-gdb -j$(nproc)` - for gdbserver, run `make all-gdbserver -j$(nproc)`.
47
56
48
57
gdb will sit under gdb/gdb.
49
58
gdbserver will sit under gdbserver/gdbserver.
@@ -63,29 +72,30 @@ Download and extract the latest edition from https://gmplib.org/.
63
72
I used the 6.3.0 edition.
64
73
65
74
Work according to the following steps:
66
-
I) Create a build dir and cd into it.
67
-
II) run `../configure CC=<CROSS_COMPILER_C> CXX=<CROSS_COMPILER_CPP> --enable-static --host=<HOST_NAME>`
68
-
III) run `make -j$(nproc)`
69
-
IV) run `mkdir ./.libs/include/`
70
-
V) run `cp gmp.h ./.libs/include/`
71
-
VI) run `mkdir ./.libs/lib`
72
-
VII) run `cp ./.libs/libgmp.a ./.libs/lib`
75
+
1. Create a build dir and cd into it.
76
+
2. run `../configure CC=<CROSS_COMPILER_C> CXX=<CROSS_COMPILER_CPP> --enable-static --host=<HOST_NAME>`
77
+
3. run `make -j$(nproc)`
78
+
4. run `mkdir ./.libs/include/`
79
+
5. run `cp gmp.h ./.libs/include/`
80
+
6. run `mkdir ./.libs/lib`
81
+
7. run `cp ./.libs/libgmp.a ./.libs/lib`
73
82
74
83
## 3) Compiling libmpfr
75
84
76
85
Download and extract the latest edition from https://www.mpfr.org/.
77
86
I used the 4.2.1 edition.
78
87
79
88
Work according to the following steps:
80
-
I) Create a build dir and cd into it.
81
-
II) run `../configure CC=<CROSS_COMPILER_C> CXX=<CROSS_COMPILER_CPP> --enable-static --with-gmp-build=<COMPILATION_DIR_PATH> --host=<HOST_NAME>`
82
-
III) run `make -j$(nproc)`
83
-
IV) run `mkdir ./src/.libs/lib`
84
-
V) run `cp ./src/.libs/libmpfr.a ./src/.libs/lib`
85
-
VI) run `mkdir ./src/.libs/include`
86
-
VII) run `cp ../src/mpfr.h ./src/.libs/include/`
89
+
1. Create a build dir and cd into it.
90
+
2. run `../configure CC=<CROSS_COMPILER_C> CXX=<CROSS_COMPILER_CPP> --enable-static --with-gmp-build=<COMPILATION_DIR_PATH> --host=<HOST_NAME>`
91
+
3. run `make -j$(nproc)`
92
+
4. run `mkdir ./src/.libs/lib`
93
+
5. run `cp ./src/.libs/libmpfr.a ./src/.libs/lib`
94
+
6. run `mkdir ./src/.libs/include`
95
+
7. run `cp ../src/mpfr.h ./src/.libs/include/`
87
96
88
97
## 4) Compiling gdb
89
98
90
99
Work according to the same process as described under the compilation to the host platform, aside from the configure script:
0 commit comments