author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Mon, 08 Jul 2019 12:34:18 +0100 | |
changeset 200 | e9250da35d87 |
parent 191 | 18b32a5811f4 |
child 213 | b13fd3784ba0 |
permissions | -rw-r--r-- |
161 | 1 |
|
2 |
Welcome file |
|
3 |
||
4 |
||
5 |
# Building GDB for use with *libgdbs* |
|
6 |
||
7 |
As of today, *libgdbs* require a very recent version of GDB. This is because |
|
8 |
*libgdbs* requires various patches. Some of them are are already upstreamed |
|
9 |
to [GDB's master branch][1], some of them are in process. |
|
10 |
||
11 |
Therefore you may need to compile suitable GDB yourself. A git repository with |
|
12 |
all the patches can be found at [https://bitbucket.org/janvrany/binutils-gdb][2] |
|
13 |
*in branch `users/jv/vdb`* (note the branch!) |
|
14 |
||
15 |
## Linux |
|
16 |
||
17 |
### Preparing build environment |
|
18 |
||
181
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
19 |
* On *Debian Buster* (tested on as of 2018-11-26) |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
20 |
``` |
191
18b32a5811f4
doc: add `libsource-highlight-dev` to build prereqs
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
181
diff
changeset
|
21 |
apt-get install build-essentials texinfo python3-dev flex bison libfl libexpat-dev libsource-highlight-dev |
181
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
22 |
``` |
161 | 23 |
|
181
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
24 |
* On *Ubuntu 18.04* (tested on as of 2019-03-20) |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
25 |
``` |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
26 |
apt-get install g++ make texinfo python3-dev flex bison libfl2 libexpat1-dev |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
27 |
``` |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
28 |
|
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
29 |
### Compiling GDB |
161 | 30 |
|
31 |
git clone https://bitbucket.org/janvrany/binutils-gdb.git |
|
32 |
cd binutils-gdb |
|
33 |
./configure \ |
|
34 |
--disable-werror \ |
|
35 |
--with-guile=no \ |
|
36 |
--with-python=/usr/bin/python3 \ |
|
37 |
--enable-targets="i686-pc-linux-gnu,x86_64-pc-linux-gnu,i686-w64-mingw32,x86_64-w64-mingw32,riscv64-pc-linux-gnu,ppc-pc-linux-gnu" |
|
38 |
make -j4 |
|
39 |
||
40 |
||
41 |
You may want to tweak target list to fot your needs, the above list includes |
|
181
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
42 |
both i686 and x86_64 Linux, both i686 and x86_64 Windows,PowerPC and RISC-V 64 |
161 | 43 |
Linux. |
44 |
||
45 |
## Windows using MSYS2 and MINGW64 |
|
46 |
||
181
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
47 |
Following recipe has been tested on Windows 7 anc Windows 10 using [MSYS2][3] |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
48 |
and `MinGW 64`. |
161 | 49 |
|
50 |
### Preparing build environment |
|
51 |
||
52 |
In order to build GDB from source, you need to install [MSYS2][3] and `MinGW 64` |
|
181
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
53 |
toolchain: |
161 | 54 |
|
181
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
55 |
* Install [MSYS2][3] from [https://msys2.github.io][3]. Make sure to install |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
56 |
it to `C:\MSYS64`. Once installer finishes, update packages: |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
57 |
``` |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
58 |
C:\msys64\usr\bin\pacman.exe -Sy pacman |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
59 |
C:\msys64\usr\bin\pacman.exe -Syu |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
60 |
C:\msys64\usr\bin\pacman.exe -Su |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
61 |
``` |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
62 |
Note: during `pacman -Syu` you maybe asked to close command prompt window. |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
63 |
Don't forget to close it otherwise you will have to start from beginning. |
161 | 64 |
|
181
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
65 |
* Add `C:\msys64\usr\bin` to your `PATH`: |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
66 |
``` |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
67 |
setx PATH "%PATH%;c:\msys64\usr\bin" |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
68 |
``` |
161 | 69 |
|
70 |
* Install `MinGW 64` toolchain and other dev tools: |
|
181
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
71 |
``` |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
72 |
pacman -S git bison flex texinfo mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL mingw-w64-x86_64-libexpat mingw-w64-x86_64-python3 |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
73 |
``` |
161 | 74 |
|
75 |
### Compiling GDB |
|
76 |
||
77 |
git clone https://bitbucket.org/janvrany/binutils-gdb.git |
|
78 |
cd binutils-gdb |
|
79 |
set "PATH=%PATH%;C:\msys64\mingw64\bin" |
|
181
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
80 |
bash configure --build=x86_64-w64-mingw32 --disable-werror --with-system-readline --with-guile=no --with-python=C:\msys64\mingw64\bin\python3 --enable-targets="i686-w64-mingw32,x86_64-w64-mingw32" |
161 | 81 |
make -j4 |
82 |
||
181
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
83 |
If you don't have `C:\msys64\mingw64\bin` in your `PATH` (it is *NOT* by default), |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
84 |
then you may need to copy required libraries along `gdb.exe` otherwise GDB won't |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
85 |
start: |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
86 |
|
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
87 |
set "PATH=%PATH%;C:\msys64\mingw64\bin" |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
88 |
bash -c "for f in gdb/gdb.exe | grep MSYS | cut -d ' ' -f 3); do cp $f gdb ; done" |
33b61ec94acf
Documentation: updated GDB build instructions
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
161
diff
changeset
|
89 |
|
161 | 90 |
[1]: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=summary |
91 |
[2]: https://bitbucket.org/janvrany/binutils-gdb |
|
92 |
[3]: https://msys2.github.io/ |
|
93 |