This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA/commit] Build with -DMS_WIN64 on amd64-windows if Python enabled...


... and building with GCC.

Hello,

This patch is required to be able to build, with GCC, a GDB hosted on
x86_64-windows with Python support enabled.  Basically, the Python
headers assume that they are being read by a Microsoft compiler, which
is not necessarily the case. To work around the problem, which was
reported at http://bugs.python.org/issue4709, we add -DMS_WIN64 to
the CFLAGS.

gdb/ChangeLog:

        * configure.ac: Build with -DMS_WIN64 if building with Python
        enabled using GCC on amd64-windows.
        * configure: Regenerate.

Tested on x86_64-windows by building GDB with and without Python
support. I verified that the extra -DMS_WIN64 is not present when
building without.

I'd like to commit in a few days, unless there are objections.

Thanks,
-- 
Joel

---
 gdb/configure    |   14 ++++++++++++++
 gdb/configure.ac |   14 ++++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/gdb/configure b/gdb/configure
index d913de6..6941e9c 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -8472,11 +8472,25 @@ $as_echo "${PYTHON_CFLAGS}" >&6; }
   # unilaterally defined, and that in turn causes _SGIAPI to evaluate
   # to false.  So, we work around this issue by defining siginfo ourself
   # though the command-line.
+  #
+  # On x64 Windows, Python's include headers, and pyconfig.h in
+  # particular, rely on MS_WIN64 macro to detect that it's a 64bit
+  # version of Windows.  Unfortunately, MS_WIN64 is only defined if
+  # _MSC_VER, a Microsoft-specific macro, is defined.  So, when
+  # building on x64 Windows with GCC, we define MS_WIN64 ourselves.
+  # The issue was reported to the Python community, but still isn't
+  # solved as of 2012-10-02 (http://bugs.python.org/issue4709).
+
   case "$gdb_host" in
     irix*) if test "${GCC}" = yes; then
              CPPFLAGS="$CPPFLAGS -Dsiginfo=__siginfo"
            fi
            ;;
+    mingw64)
+           if test "${GCC}" = yes; then
+             CPPFLAGS="$CPPFLAGS -DMS_WIN64"
+           fi
+           ;;
   esac
 
   # Note that "python -m threading" cannot be used to check for
diff --git a/gdb/configure.ac b/gdb/configure.ac
index c0fd0e1..fc181fd 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -989,11 +989,25 @@ if test "${have_libpython}" != no; then
   # unilaterally defined, and that in turn causes _SGIAPI to evaluate
   # to false.  So, we work around this issue by defining siginfo ourself
   # though the command-line.
+  #
+  # On x64 Windows, Python's include headers, and pyconfig.h in
+  # particular, rely on MS_WIN64 macro to detect that it's a 64bit
+  # version of Windows.  Unfortunately, MS_WIN64 is only defined if
+  # _MSC_VER, a Microsoft-specific macro, is defined.  So, when
+  # building on x64 Windows with GCC, we define MS_WIN64 ourselves.
+  # The issue was reported to the Python community, but still isn't
+  # solved as of 2012-10-02 (http://bugs.python.org/issue4709).
+
   case "$gdb_host" in
     irix*) if test "${GCC}" = yes; then
              CPPFLAGS="$CPPFLAGS -Dsiginfo=__siginfo"
            fi
            ;;
+    mingw64)
+           if test "${GCC}" = yes; then
+             CPPFLAGS="$CPPFLAGS -DMS_WIN64"
+           fi
+           ;;
   esac
 
   # Note that "python -m threading" cannot be used to check for
-- 
1.7.9.5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]