Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: David Edelsohn <dje.gcc@gmail.com>
To: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: GDB Python extension on AIX
Date: Thu, 11 Aug 2016 01:56:00 -0000	[thread overview]
Message-ID: <CAGWvnynYHy9zMHYN6m=WL5wm7WRnBsLJop5Z8zsuoaVcbrySfQ@mail.gmail.com> (raw)

When Python is installed correctly on AIX and the GDB configuration
process finds Python, some of the source files that implement the GDB
Python extension fail to compile on AIX with the following error:

In file included from
/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/6.1.0/include/c++/math.h:36:0,
                 from build-gnulib/import/math.h:27,
                 from /opt/freeware/include/python2.7/pyport.h:325,
                 from /opt/freeware/include/python2.7/Python.h:58,
                 from /home/dje/src/binutils-gdb/gdb/python/python-internal.h:9
,
                 from /home/dje/src/binutils-gdb/gdb/python/python.c:94:
/opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/6.1.0/include/c++/cmath:640:11:
error: '::isnan' has not been declared
   using ::isnan;
           ^~~~~
Makefile:2593: recipe for target 'python.o' failed

This is due to a Python extension header redefining feature test
macros in the compiler namespace that interfere with AIX math.h and
libstdc++ math.h behavior

gdb/python/python-internal.h includes the following fragment:

/* Python 2.4 doesn't include stdint.h soon enough to get {u,}intptr_t
   needed by pyport.h.  */
/* /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.

   Same problem with _XOPEN_SOURCE.  */
#undef _POSIX_C_SOURCE
#undef _XOPEN_SOURCE

Redefining and undefining feature test macros, such as _POSIX_C_SOURCE
and _XOPEN_SOURCE are not very wise things to do, especially in the
middle of a sequence of includes that already may have included other
system header files with conditionals that were affected by the macros
in their original state.

If I comment out this unfortunate fragment, GDB is able to compile on
AIX with the Python extension.

Is this fragment necessary for other targets?  Would the GDB community
at least be open to a proposal to bracket this fragment with

#ifndef _AIX
...
#endif

?

What is the preferred way to address this?

Thanks, David


             reply	other threads:[~2016-08-11  1:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-11  1:56 David Edelsohn [this message]
     [not found] ` <mvmk2fnsr0a.fsf@hawking.suse.de>
2016-08-11 13:56   ` David Edelsohn
2016-08-18  7:21     ` Joel Brobecker
2016-08-18 13:00       ` David Edelsohn
2016-08-19  5:49         ` Joel Brobecker
2016-08-19 15:36           ` David Edelsohn
2016-08-31 23:41             ` Joel Brobecker

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='CAGWvnynYHy9zMHYN6m=WL5wm7WRnBsLJop5Z8zsuoaVcbrySfQ@mail.gmail.com' \
    --to=dje.gcc@gmail.com \
    --cc=gdb@sourceware.org \
    /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