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
This repository contains a dockerfile and build scripts to compile gdb and gdbserver statically for multiple architectures.
8
10
Currently, the supported architectures are:
@@ -14,7 +16,7 @@ You can easily expand it to support more architectures by adding the appropriate
14
16
15
17
NOTE: You don't need to interact with the dockerfile directly, as the Makefile will take care of everything for you.
16
18
17
-
## Building for a specific architecture
19
+
###Building for a specific architecture
18
20
19
21
To build for a specific architecture, you can use the following command:
20
22
```bash
@@ -35,25 +37,25 @@ build/
35
37
...
36
38
```
37
39
38
-
## Building for all architectures
40
+
###Building for all architectures
39
41
40
42
To build for all architectures, you can use the following command:
41
43
```bash
42
44
make build
43
45
```
44
46
45
-
## Cleaning the build
47
+
###Cleaning the build
46
48
47
49
To clean the build, you can use the following command:
48
50
```bash
49
51
make clean
50
52
```
51
53
52
-
# Notes about this file - read before proceeding!
54
+
##Notes about this file - read before proceeding!
53
55
54
56
While i already provided the gdb/gdbserver-15 statically compiled binaries handed out to you, some people might want to compile it to a different architecture, or compile a newer version of gdb in the future :). This rest of the file contains my compilation documentation so that you could save yourself some time and do it yourself, if you wish.
55
57
56
-
## <VARAIBLES> in the script
58
+
###<VARAIBLES> in the script
57
59
58
60
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.
59
61
@@ -66,9 +68,9 @@ Examples to the <VARIABLES> throughout the script:
66
68
Environment info:
67
69
- 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...).
68
70
69
-
# Compiling gdb statically to the host platform
71
+
##Compiling gdb statically to the host platform
70
72
71
-
## 1) Compiling iconv
73
+
###1) Compiling iconv
72
74
73
75
While compiling iconv is not a must, the libc-provided iconv (a utility to convert between encodings) may fail on different architectures,
74
76
at least in my experiance. Thus, I recommended using a custom libiconv and compiling it into gdb.
@@ -85,7 +87,7 @@ V) run `cp -r ./include ./lib/.libs/`
85
87
VI) run `mkdir ./lib/.libs/lib/`
86
88
VII) run `cp ./lib/.libs/libiconv.a ./lib/.libs/lib/`
87
89
88
-
## 2) Compiling gdb
90
+
###2) Compiling gdb
89
91
90
92
Clone gdb from sourceware - https://sourceware.org/git/binutils-gdb.git.
91
93
I checked out to the 15.1 tag.
@@ -99,16 +101,16 @@ IV) run `make all-gdb -j$(nproc)` - for gdbserver, run `make all-gdbserver -j$(n
99
101
gdb will sit under gdb/gdb.
100
102
gdbserver will sit under gdbserver/gdbserver.
101
103
102
-
# Cross compiling gdb statically to other architectures.
104
+
##Cross compiling gdb statically to other architectures.
103
105
104
106
Cross compiling gdb statically is a bit more complicated then regular static compilation. In order to cross compile gdb statically, we will need to compile libgmp and libmpfr as well as iconv.
105
107
106
-
## 1) Compiling iconv
108
+
###1) Compiling iconv
107
109
108
110
Work according to the same process as described under the compilation to the host platform, aside from the configure script:
109
111
IV) run `../configure --enable-static CC=<CROSS_COMPILER_C> CXX=<CROSS_COMPILER_CPP> --host=<HOST_NAME>`
110
112
111
-
## 2) Compiling libgmp
113
+
###2) Compiling libgmp
112
114
113
115
Download and extract the latest edition from https://gmplib.org/.
114
116
I used the 6.3.0 edition.
@@ -122,7 +124,7 @@ V) run `cp gmp.h ./.libs/include/`
122
124
VI) run `mkdir ./.libs/lib`
123
125
VII) run `cp ./.libs/libgmp.a ./.libs/lib`
124
126
125
-
## 3) Compiling libmpfr
127
+
###3) Compiling libmpfr
126
128
127
129
Download and extract the latest edition from https://www.mpfr.org/.
128
130
I used the 4.2.1 edition.
@@ -136,7 +138,7 @@ V) run `cp ./src/.libs/libmpfr.a ./src/.libs/lib`
136
138
VI) run `mkdir ./src/.libs/include`
137
139
VII) run `cp ../src/mpfr.h ./src/.libs/include/`
138
140
139
-
## 4) Compiling gdb
141
+
###4) Compiling gdb
140
142
141
143
Work according to the same process as described under the compilation to the host platform, aside from the configure script:
0 commit comments