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]

[commit] Fix build failure with Python installed in non-system location.


Hello,

The debugger fails to build when configure with --python-python=<path>
where <path> is a non-system location.  The reason is a warning made
fatal due to the definition of _XOPEN_SOURCE inside pyconfig.h.  This
is exactly the same problem as with _POSIX_C_SOURCE, handled in
python-internal.h as follow:

| /* /usr/include/features.h on linux systems will define _POSIX_C_SOURCE
|    if it sees _GNU_SOURCE (which config.h will define).
|    pyconfig.h defines _POSIX_C_SOURCE to a different value than
|    /usr/include/features.h does causing compilation to fail.
|    To work around this, undef _POSIX_C_SOURCE before we include Python.h.  */
| #undef _POSIX_C_SOURCE

This patch fixes this problem the same way.  We discussed the problem on
IRC, and talked about using -isystem to provide the location of the Python
includes, and eventually just decided that it was better to just keep it
simple.

2010-06-30  Joel Brobecker  <brobecker@adacore.com>

        * python/python-internal.h (_XOPEN_SOURCE): Undefine before
        including Python.h.

Tested on x86_64-linux (I removed -Werror, allowing me to build and run
the testsuite without this patch first). No regression.

Checked in.

---
 gdb/ChangeLog                |    5 +++++
 gdb/python/python-internal.h |    5 ++++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b3f6fc5..30802c1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2010-06-30  Joel Brobecker  <brobecker@adacore.com>
+
+	* python/python-internal.h (_XOPEN_SOURCE): Undefine before
+	including Python.h.
+
 2010-06-29  Doug Evans  <dje@google.com>
 
 	PR gdb/11702
diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index daaed2c..630d191 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -30,8 +30,11 @@
    if it sees _GNU_SOURCE (which config.h will define).
    pyconfig.h defines _POSIX_C_SOURCE to a different value than
    /usr/include/features.h does causing compilation to fail.
-   To work around this, undef _POSIX_C_SOURCE before we include Python.h.  */
+   To work around this, undef _POSIX_C_SOURCE before we include Python.h.
+
+   Same problem with _XOPEN_SOURCE.  */
 #undef _POSIX_C_SOURCE
+#undef _XOPEN_SOURCE
 
 #if HAVE_LIBPYTHON2_4
 #include "python2.4/Python.h"
-- 
1.7.1


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