RE: Building GDB 7.3.92 with MinGW

Pierre Muller
2012-01-15T17:01:45Z

Eli,

I also wrongly supposed that configure prefix or related entries should
be msys pathes.
It seems that using directly a mingw32 path for prefix
works well. This allows to get a working relocate_gdb_directory
call in main.c
Of course, this only works for really existing directories, but
from what I read in the sources, this was by design.
A configured directory should only be substituted if the substitute result
is an existing directory.

So I used
--prefix=e:/pas/fpc-2.6.0
to run configure
ran 'make all install'
and got a first installation in e:\pas\fpc-2.6.0
I then tried
make install prefix=e:/pas/fpc-2.7.1/gdb
and debugged GDB with itself in e:\pas\fpc-2.7.1\gdb\bin
gdb ./gdb
added a break relocate_gdb_directory
and could check that
e:/pas/fpc-2.6.0/share/gdb
was transformed into
e:\pas\fpc-2.7.1\gdb\share\gdb

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Eli Zaretskii
> Envoyé : dimanche 15 janvier 2012 04:55
> À : Pierre Muller
> Cc : asmwarrior@gmail.com; brobecker@adacore.com; dje@google.com; gdb-
> patches@sourceware.org
> Objet : Re: Building GDB 7.3.92 with MinGW
>
> > From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
> > Cc: <brobecker@adacore.com>, <dje@google.com>, <gdb-
> patches@sourceware.org>
> > Date: Sat, 14 Jan 2012 23:32:10 +0100
> >
> > After some debugging,
> > I believe that the main problem is related to the fact
> > that we use msys environment (which has msys specific mounts)
> > to compile a mingw32 GDB executable that knows nothing about those msys
> > mount points!
> >
> > config.h
> > get several entries with directories.
> > All but WITH_PYTHON_PATH (which is mingw32 compatible)
> > are msys paths:
> > DEBUGDIR, GDB_DATADIR and JIT_READER_DIR
> > but those msys pathes are not interpreted correctly by
> > a mingw32 executable (i.e. gdb.exe itself).
>
> This might explain how it works for me: I manually edit config.h to
> convert MSYS file names to native Windows ones, before building GDB.

I also thought that msys system required
real msys pathes to function correctly, but it seems to handle
Mingw32 pathes starting with X:/ correctly also
which solves the problem.
I am still surprised that in fact, we really need to do
this in order to get the correct behavior.

> Perhaps Joel could tell where and how the relocation of the standard
> directories happens for him, and then we could try stepping through
> that code with a debugger.
>
> > I do believe that this is an error in the mingw32 configuration
> > and that it should be fixed in those configuration files...
>
> A simple Sed script will do, but it must be injected into the
> configure script.

That not true in case you really have other mount points
I personally have my different GDB sources located inside cygwin
/usr/local/src
subdirectories, and I also have
this cygwin /usr/local/src mounted as /usr/local/src on mysys,
which is nice in a way, but leads me to not be able to
remember in with Windows directory the sources really are ...

> Alternatively, did you try to use MinGW file names in --prefix when
> configuring in the first place?
As said above, it seems that this is the right answer!

Pierre Muller