From: Doug Evans <dje@google.com>
To: Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>
Cc: gdb-patches@sourceware.org, Eli Zaretskii <eliz@gnu.org>,
asmwarrior@gmail.com, Tom Tromey <tromey@redhat.com>
Subject: Re: Possible fix for mingw32 directory relocation problems
Date: Tue, 17 Jan 2012 09:56:00 -0000 [thread overview]
Message-ID: <CADPb22Q+3zmxi4-cr=-ze7eyJEizDqL_Yn2YxtuopKD3ZaDR+A@mail.gmail.com> (raw)
In-Reply-To: <4f143c53.ca3c440a.1d95.ffff9b71SMTPIN_ADDED@mx.google.com>
[-- Attachment #1: Type: text/plain, Size: 2570 bytes --]
On Mon, Jan 16, 2012 at 7:03 AM, Pierre Muller
<pierre.muller@ics-cnrs.unistra.fr> wrote:
> After some debugging,
> we finally managed to find out that
> mingw32 specific directory relocations are related
> to msys -> mingw32 argument conversions.
Thanks for the detective work!
> http://sourceware.org/ml/gdb-patches/2012-01/msg00537.html
>
> This is explained in:
>
> http://www.mingw.org/wiki/Posix_path_conversion
>
> This page also allows to understand why
> using mingw32 style paths for prefix at configure
> level works and avoid the troubles encountered.
>
> This conversion concerns defines passed by command line arguments
> to gcc, which are specific to main.o
> compilation, as found in gdb/Makefile.in
> 1520-
> 1521:# main.o needs an explicit build rule to get TARGET_SYSTEM_ROOT and
> BINDIR.
> 1522-main.o: $(srcdir)/main.c
> 1523: $(COMPILE) $(TARGET_SYSTEM_ROOT_DEFINE) -DBINDIR=\"$(bindir)\"
> $(srcdir)/main.c
> 1524- $(POSTCOMPILE)
> 1525-
>
> But this leads to a conversion:
> -DBINDIR="/usr/local/bin\"
> gets transformed into '-D' 'BINDIR="E:/msys/mingw32/msys/1.0/local/bin"'
>
> While other pates used in relocate_gdb_directory calls
> are macros defined inside gdb/config.h
>
> config.h:#define DEBUGDIR "/usr/local/lib/debug"
> config.h:#define GDB_DATADIR "/usr/local/share/gdb"
> config.h:#define JIT_READER_DIR "/usr/local/lib/gdb"
>
> Those are of course not affected by msys command-line argument conversion.
>
> The first question is:
> Why do we need to pass BINDIR (and TARGET_SYSTEM_ROOT_DEFINE)
> at the command line instead of inside config.h as for other
> directories?
We don't need to pass them on the command line.
> If the answer to the first question is "we don't",
> then I need help about how to convert those
> Makefile.in variables into new entries of generated config.h file.
Possible patch is attached.
Can you try it? I don't know that it will fix things, but based on
what you've said it seems reasonable to try.
There is an open issue that the current --with-sysroot relocatability
computation is different than what GDB_AC_WITH_DIR does. We should
fix that regardless. I've left that as a separate issue. [We should
resolve it before checkin, but at this point I'm willing to just
experiment until we know what the right fix is.]
> I don't have enough knowledge about autoconf scripts to
> handle this...
> An extra bonus of this change would be that it would
> render the special rule for main.o compilation unnecessary.
[-- Attachment #2: mingw-config.patch --]
[-- Type: application/octet-stream, Size: 3884 bytes --]
2012-01-16 Doug Evans <dje@sebabeach.org>
* Makefile.in (TARGET_SYSTEM_ROOT, TARGET_SYSTEM_ROOT_DEFINE): Delete.
(main.o): Remove rule.
* configure.ac (BINDIR): Define in config.h.
(--with-sysroot): Define using GDB_AC_WITH_DIR.
* configure: Regenerate.
* config.in: Regenerate.
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.1186
diff -u -p -r1.1186 Makefile.in
--- Makefile.in 10 Jan 2012 16:30:43 -0000 1.1186
+++ Makefile.in 17 Jan 2012 06:42:31 -0000
@@ -166,10 +166,6 @@ INTL = @LIBINTL@
INTL_DEPS = @LIBINTL_DEP@
INTL_CFLAGS = @INCINTL@
-# Did the user give us a --with-sysroot option?
-TARGET_SYSTEM_ROOT = @TARGET_SYSTEM_ROOT@
-TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
-
# Did the user give us a --with-gdb-datadir option?
GDB_DATADIR = @GDB_DATADIR@
@@ -1518,11 +1514,6 @@ ALLDEPFILES = \
# Some files need explicit build rules (due to -Werror problems) or due
# to sub-directory fun 'n' games.
-# main.o needs an explicit build rule to get TARGET_SYSTEM_ROOT and BINDIR.
-main.o: $(srcdir)/main.c
- $(COMPILE) $(TARGET_SYSTEM_ROOT_DEFINE) -DBINDIR=\"$(bindir)\" $(srcdir)/main.c
- $(POSTCOMPILE)
-
# FIXME: cagney/2003-08-10: "monitor.c" gets -Wformat-nonliteral
# errors. It turns out that that is the least of monitor.c's
# problems. The function print_vsprintf appears to be using
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/configure.ac,v
retrieving revision 1.152
diff -u -p -r1.152 configure.ac
--- configure.ac 4 Jan 2012 08:17:00 -0000 1.152
+++ configure.ac 17 Jan 2012 06:42:32 -0000
@@ -125,6 +125,14 @@ GDB_AC_WITH_DIR(DEBUGDIR, separate-debug
[look for global separate debug info in this path @<:@LIBDIR/debug@:>@],
[${libdir}/debug])
+# We can't pass paths as command line arguments.
+# Mingw32 tries to be clever and will convert the paths for us.
+# For example -DBINDIR="/usr/local/bin" passed on the command line may get
+# converted to -DBINDIR="E:/msys/mingw32/msys/1.0/local/bin".
+# This breaks GDB's relocatable path conversions since paths passed in
+# config.h do not get so translated.
+AC_DEFINE_DIR(BINDIR, bindir, [Directory of programs.])
+
# GDB's datadir relocation
GDB_AC_WITH_DIR(GDB_DATADIR, gdb-datadir,
@@ -1753,42 +1761,12 @@ fi
dnl Handle optional features that can be enabled.
-target_sysroot_reloc=0
-AC_ARG_WITH(sysroot,
-AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], [search for usr/lib et al within DIR]),
-[
- case ${with_sysroot} in
- yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_alias}/sys-root' ;;
- *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
- esac
-
- TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
-
- if test "x$prefix" = xNONE; then
- test_prefix=/usr/local
- else
- test_prefix=$prefix
- fi
- if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
- test_exec_prefix=$test_prefix
- else
- test_exec_prefix=$exec_prefix
- fi
- case ${TARGET_SYSTEM_ROOT} in
- "${test_prefix}"|"${test_prefix}/"*|\
- "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
- '${prefix}'|'${prefix}/'*|\
- '${exec_prefix}'|'${exec_prefix}/'*)
- target_sysroot_reloc=1
- ;;
- esac
-], [
- TARGET_SYSTEM_ROOT=
- TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"\"'
-])
-TARGET_SYSTEM_ROOT_DEFINE="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE=$target_sysroot_reloc"
-AC_SUBST(TARGET_SYSTEM_ROOT)
-AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
+if test "x$with_sysroot" = xyes; then
+ with_sysroot="${exec_prefix}/${target_alias}/sys-root"
+fi
+GDB_AC_WITH_DIR(TARGET_SYSTEM_ROOT, sysroot,
+ [search for usr/lib et al within PATH],
+ [])
GDB_AC_WITH_DIR(SYSTEM_GDBINIT, system-gdbinit,
[automatically load a system-wide gdbinit file],
next parent reply other threads:[~2012-01-17 7:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4f143c53.ca3c440a.1d95.ffff9b71SMTPIN_ADDED@mx.google.com>
2012-01-17 9:56 ` Doug Evans [this message]
2012-01-17 13:40 ` asmwarrior
2012-01-17 14:15 ` asmwarrior
2012-01-17 15:03 ` Pierre Muller
[not found] ` <4f158a75.65ecd80a.69cb.7083SMTPIN_ADDED@mx.google.com>
2012-01-17 15:34 ` asmwarrior
[not found] ` <4f158a77.833ed80a.629b.7837SMTPIN_ADDED@mx.google.com>
2012-01-17 16:11 ` Doug Evans
2012-01-18 19:01 ` Doug Evans
[not found] <4f143c35.4fecd80a.473e.ffffbd75SMTPIN_ADDED@mx.google.com>
2012-01-17 2:49 ` asm warrior
[not found] ` <CADPb22SvBMEt9=EwMNZE6m+=_jfJZxTt1C2Pn-rH9OpHKUJCJQ@mail.gmail.com>
[not found] ` <4F150434.3020102@gmail.com>
[not found] ` <CADPb22TK7_csatjnORZoLeuRty9aXM+=hzBykYeWk6XzG-aPjQ@mail.gmail.com>
2012-01-17 6:48 ` asmwarrior
2012-01-17 7:00 ` Asmwarrior
2012-01-16 15:17 Pierre Muller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADPb22Q+3zmxi4-cr=-ze7eyJEizDqL_Yn2YxtuopKD3ZaDR+A@mail.gmail.com' \
--to=dje@google.com \
--cc=asmwarrior@gmail.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=pierre.muller@ics-cnrs.unistra.fr \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox