I've download gdb-6.5.bz2.tar. Untar this file. I write: LDFLAGS=-static ./configure
but as a result i get a gdb, which require a so files, for instance: ncurses.so.5 libc.so.0 etc
How i can build statically ?
This message seems to imply that the correct usage is
$ make LDFLAGS=-static
Which seems surprising. Unfortunately, it also says it fails to build, and there are no follow-ups. Still the message is from 1999 so everything might have changed, perhaps the proper way today is to do it your way.
Both gcc and gdb disrespect the --enable-static flag which should be passed to configure, the correct way to do this is:
In the case of gdb 8.0, you have to also add the --disable-interprocess-agent to successfully build a static version:
mkdir build-gdb && cd build-gdb && ../configure --prefix=... --enable-static --disable-interprocess-agent ...
In the case of gcc 7.1, you have to also add the --disable-libcc1 to successfully build a static version:
mkdir build-gcc && cd build-gcc && ../configure --prefix=... --enable-static --disable-shared --disable-libcc1 ...
I recently went through the hassle of compiling gdb-15.x and gdb-server-15.x for multiple architectures.
Whoever wants to use this newer version can download it at gdb-static
The repository also contains a compilation.md file describing the necessary steps in order to compile gdb/gdbserver statically (as of now).
gdb 15 contains vast improvements over the latest static gdb i could find online (8.3.1).
EDIT: The repository has been updated to support gdb-16.x
README in your github project is clear enough on the steps - how to build static dependencies first, then how to change gdb's Makefile to build statically - SO answers ideally contain more than "links to external sources". Yes, I'm suggesting you write down the steps taken - here. Definitely reference your github project, but don't make the answer useless should that, for whatever reason, go away at a point.
ldd /usr/bin/gdbis to be trusted. I'm not sure whether you'd really want to replace all those with static libraries, but that's the list of shared libraries used bygdbon this (antique) platform.