Skip to content

Commit fe4c076

Browse files
committed
documentation: split & improve the readme file
This commit splits the readme file into 2 files - the readme which contains instructions on how to download our latest release, and on how to use our build scripts in order to quickly build gdb statically. The second file is a compilation guide that contains explanations on how to manually compile gdb statically.
1 parent 0890922 commit fe4c076

File tree

2 files changed

+100
-97
lines changed

2 files changed

+100
-97
lines changed

README.md

Lines changed: 9 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# Repository of static gdb and gdbserver
22

3-
The statically compiled gdb / gdbserver binaries are avaliable to download under github releases!
3+
## **The statically compiled gdb / gdbserver binaries are avaliable to download under github releases!**
44

5-
# Compiling gdb using docker
5+
link: [gdb-static github releases](https://github.com/guyush1/gdb-static/releases)
6+
7+
## For manual gdb/gdbserver compilation instructions, have a look at the compilation.md file
8+
9+
## Compiling gdb using docker
610

711
This repository contains a dockerfile and build scripts to compile gdb and gdbserver statically for multiple architectures.
812
Currently, the supported architectures are:
@@ -14,7 +18,7 @@ You can easily expand it to support more architectures by adding the appropriate
1418

1519
NOTE: You don't need to interact with the dockerfile directly, as the Makefile will take care of everything for you.
1620

17-
## Building for a specific architecture
21+
### Building for a specific architecture
1822

1923
To build for a specific architecture, you can use the following command:
2024
```bash
@@ -35,108 +39,16 @@ build/
3539
...
3640
```
3741

38-
## Building for all architectures
42+
### Building for all architectures
3943

4044
To build for all architectures, you can use the following command:
4145
```bash
4246
make build
4347
```
4448

45-
## Cleaning the build
49+
### Cleaning the build
4650

4751
To clean the build, you can use the following command:
4852
```bash
4953
make clean
5054
```
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:
61-
<CROSS_COMPILER_C> - arm-linux-gnueabi-gcc
62-
<CROSS_COMPILER_CPP> - arm-linux-gnueabi-g++
63-
<HOST_NAME> - arm-linux-gnueabi
64-
<COMPILATION_DIR_PATH> - /home/username/projects/libgmp-x.y.z/build-arm/
65-
66-
Environment info:
67-
- 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:
142-
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 --with-gmp=<COMPILATION_DIR_PATH>/.libs/ --with-mpfr=<COMPILATION_DIR_PATH>/src/.libs/ CC=<CROSS_COMPILER_C> CXX=<CROSS_COMPILER_CPP> --host=<HOST_NAME>`

compilation.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Notes about this file - read before proceeding!
2+
3+
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:
10+
<CROSS_COMPILER_C> - arm-linux-gnueabi-gcc
11+
<CROSS_COMPILER_CPP> - arm-linux-gnueabi-g++
12+
<HOST_NAME> - arm-linux-gnueabi
13+
<COMPILATION_DIR_PATH> - /home/username/projects/libgmp-x.y.z/build-arm/
14+
15+
Environment info:
16+
- 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:
91+
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 --with-gmp=<COMPILATION_DIR_PATH>/.libs/ --with-mpfr=<COMPILATION_DIR_PATH>/src/.libs/ CC=<CROSS_COMPILER_C> CXX=<CROSS_COMPILER_CPP> --host=<HOST_NAME>`

0 commit comments

Comments
 (0)