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
## For manual gdb/gdbserver compilation instructions, have a look at the compilation.md file
8
+
9
+
## Compiling gdb using docker
6
10
7
11
This repository contains a dockerfile and build scripts to compile gdb and gdbserver statically for multiple architectures.
8
12
Currently, the supported architectures are:
@@ -14,7 +18,7 @@ You can easily expand it to support more architectures by adding the appropriate
14
18
15
19
NOTE: You don't need to interact with the dockerfile directly, as the Makefile will take care of everything for you.
16
20
17
-
## Building for a specific architecture
21
+
###Building for a specific architecture
18
22
19
23
To build for a specific architecture, you can use the following command:
20
24
```bash
@@ -35,108 +39,16 @@ build/
35
39
...
36
40
```
37
41
38
-
## Building for all architectures
42
+
###Building for all architectures
39
43
40
44
To build for all architectures, you can use the following command:
41
45
```bash
42
46
make build
43
47
```
44
48
45
-
## Cleaning the build
49
+
###Cleaning the build
46
50
47
51
To clean the build, you can use the following command:
48
52
```bash
49
53
make clean
50
54
```
51
-
52
-
# Notes about this file - read before proceeding!
53
-
54
-
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
-
56
-
## <VARAIBLES> in the script
57
-
58
-
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
-
60
-
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...).
68
-
69
-
# Compiling gdb statically to the host platform
70
-
71
-
## 1) Compiling iconv
72
-
73
-
While compiling iconv is not a must, the libc-provided iconv (a utility to convert between encodings) may fail on different architectures,
74
-
at least in my experiance. Thus, I recommended using a custom libiconv and compiling it into gdb.
75
-
76
-
Download the source from https://github.com/roboticslibrary/libiconv.git
77
-
Make sure to check out to a stable tag (in my case - v1.17).
78
-
79
-
Work according to the following steps:
80
-
I) run `./gitsub.sh pull`
81
-
II) run `./autogen.sh` to create the configure script from configure.sh.
82
-
III) create a build dir (e.g build), and then cd into it.
83
-
IV) run `../configure --enable-static`
84
-
V) run `cp -r ./include ./lib/.libs/`
85
-
VI) run `mkdir ./lib/.libs/lib/`
86
-
VII) run `cp ./lib/.libs/libiconv.a ./lib/.libs/lib/`
87
-
88
-
## 2) Compiling gdb
89
-
90
-
Clone gdb from sourceware - https://sourceware.org/git/binutils-gdb.git.
91
-
I checked out to the 15.2 tag.
92
-
93
-
Work according to the following steps:
94
-
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.
95
-
II) create a build dir.
96
-
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`
97
-
IV) run `make all-gdb -j$(nproc)` - for gdbserver, run `make all-gdbserver -j$(nproc)`.
98
-
99
-
gdb will sit under gdb/gdb.
100
-
gdbserver will sit under gdbserver/gdbserver.
101
-
102
-
# Cross compiling gdb statically to other architectures.
103
-
104
-
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
-
106
-
## 1) Compiling iconv
107
-
108
-
Work according to the same process as described under the compilation to the host platform, aside from the configure script:
109
-
IV) run `../configure --enable-static CC=<CROSS_COMPILER_C> CXX=<CROSS_COMPILER_CPP> --host=<HOST_NAME>`
110
-
111
-
## 2) Compiling libgmp
112
-
113
-
Download and extract the latest edition from https://gmplib.org/.
114
-
I used the 6.3.0 edition.
115
-
116
-
Work according to the following steps:
117
-
I) Create a build dir and cd into it.
118
-
II) run `../configure CC=<CROSS_COMPILER_C> CXX=<CROSS_COMPILER_CPP> --enable-static --host=<HOST_NAME>`
119
-
III) run `make -j$(nproc)`
120
-
IV) run `mkdir ./.libs/include/`
121
-
V) run `cp gmp.h ./.libs/include/`
122
-
VI) run `mkdir ./.libs/lib`
123
-
VII) run `cp ./.libs/libgmp.a ./.libs/lib`
124
-
125
-
## 3) Compiling libmpfr
126
-
127
-
Download and extract the latest edition from https://www.mpfr.org/.
128
-
I used the 4.2.1 edition.
129
-
130
-
Work according to the following steps:
131
-
I) Create a build dir and cd into it.
132
-
II) run `../configure CC=<CROSS_COMPILER_C> CXX=<CROSS_COMPILER_CPP> --enable-static --with-gmp-build=<COMPILATION_DIR_PATH> --host=<HOST_NAME>`
133
-
III) run `make -j$(nproc)`
134
-
IV) run `mkdir ./src/.libs/lib`
135
-
V) run `cp ./src/.libs/libmpfr.a ./src/.libs/lib`
136
-
VI) run `mkdir ./src/.libs/include`
137
-
VII) run `cp ../src/mpfr.h ./src/.libs/include/`
138
-
139
-
## 4) Compiling gdb
140
-
141
-
Work according to the same process as described under the compilation to the host platform, aside from the configure script:
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.
4
+
5
+
## <VARAIBLES> in the script
6
+
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
+
9
+
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...).
17
+
18
+
# Compiling gdb statically to the host platform
19
+
20
+
## 1) Compiling iconv
21
+
22
+
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.
24
+
25
+
Download the source from https://github.com/roboticslibrary/libiconv.git
26
+
Make sure to check out to a stable tag (in my case - v1.17).
27
+
28
+
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/`
36
+
37
+
## 2) Compiling gdb
38
+
39
+
Clone gdb from sourceware - https://sourceware.org/git/binutils-gdb.git.
40
+
I checked out to the 15.2 tag.
41
+
42
+
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)`.
47
+
48
+
gdb will sit under gdb/gdb.
49
+
gdbserver will sit under gdbserver/gdbserver.
50
+
51
+
# Cross compiling gdb statically to other architectures.
52
+
53
+
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.
54
+
55
+
## 1) Compiling iconv
56
+
57
+
Work according to the same process as described under the compilation to the host platform, aside from the configure script:
58
+
IV) run `../configure --enable-static CC=<CROSS_COMPILER_C> CXX=<CROSS_COMPILER_CPP> --host=<HOST_NAME>`
59
+
60
+
## 2) Compiling libgmp
61
+
62
+
Download and extract the latest edition from https://gmplib.org/.
63
+
I used the 6.3.0 edition.
64
+
65
+
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`
73
+
74
+
## 3) Compiling libmpfr
75
+
76
+
Download and extract the latest edition from https://www.mpfr.org/.
77
+
I used the 4.2.1 edition.
78
+
79
+
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/`
87
+
88
+
## 4) Compiling gdb
89
+
90
+
Work according to the same process as described under the compilation to the host platform, aside from the configure script:
0 commit comments