Currently, I use GCC 5.4 (i686-5.4.0-release-posix-dwarf-rt_v5-rev0 from MinGW-w64 site) under MSYS to build GDB.
Since iconv library is already contained in this package, I just need to build expat and zlib library.
I use this package MSYS-20111123.zip hosted on MinGW-w64 site.
I use this package i686-5.4.0-release-posix-dwarf-rt_v5-rev0.7z from MinGW-w64 site, I extract it under D:\mingw-builds\i686-5.4.0-release-posix-dwarf-rt_v5-rev0.
I use python 2.7.5 Windows x86, I install it in E:\code\Python27
In the file: E:\code\msys\MSYS-20111123\msys\etc\fstab
I have such mount:
D:\mingw-builds\i686-5.4.0-release-posix-dwarf-rt_v5-rev0\mingw32 /mingw
E:\code\python27 /python
download expat library from: http://expat.sourceforge.net/, when writing this article, the 2.2.6 is used, so under MSYS, extract the source code, and simply run:
$ ../configure --prefix=/mingw/i686-w64-mingw32/ --disable-shared --enable-static "CFLAGS=-O2"
make
make install
download zlib library from: http://www.zlib.net/, the current version is zlib 1.2.11, use the command below:
$ make -f win32/Makefile.gcc \
BINARY_PATH=/mingw/i686-w64-mingw32/bin \
INCLUDE_PATH=/mingw/i686-w64-mingw32/include \
LIBRARY_PATH=/mingw/i686-w64-mingw32/lib \
install
I use GDB git, which is a Read-only git, see http://www.sourceware.org/gdb/current/, to download its source, you can type:
git clone git://sourceware.org/git/binutils-gdb.git --config core.autocrlf=input --config core.eol=lf
Under MSYSGit command line, or you can install TortoiseGit (this is the git GUI under Windows), the
If you don't want to use git, just download the snapshot from: ftp://sourceware.org/pub/gdb/snapshots/current/, the cvs head version is preferred.
currently used patches are:gdb2018-07-25patches.zip, just apply them one bye one, or use the Git am command.
Create a build directory in the parent folder of GDB root, and run:
mkdir mybuild
cd mybuild
../binutils-gdb/configure \
CFLAGS="-O0 -g" \
--prefix=/mingw \
--host=mingw32 \
--build=mingw32 \
--target=mingw32 \
--with-python=/python/python \
--with-expat \
--disable-nls \
--disable-binutils \
--disable-gas \
--disable-ld \
--disable-gprof
make
make install
Note, to install a stripped version (no debug information), also, I only want to install GDB binaries (no need to install other libraries build in GDB) I use:
make install INSTALL_PROGRAM='install -s' -C gdb DESTDIR=/f/where/to/install
Hello,
I follow your procedure to build GDB under MSYS on my PC. I probably missed something but when I try to execute command under MSYS I will get message no such file or directory /usr.
It is clear there is no /usr on a PC under windows. So is it possible to build GDB on a PC with windows only ?
Thank you in advance for your help.
msys shell is old. I haven't build GDB for several years.
I think currently you need to use msys2's shell. I think you should follow the way mentioned here: History for mingw-w64-gdb - msys2/MINGW-packages
Also, I think the folder /usr exists because msys just emulate those paths under Windows.
Thank you.
I will follow your advice.