Problem building matplotlib

Hi all,

  I am trying to build Matplotlib 0.87.7 on an RHEL 4.4-derived system, with Python 2.3.4. I am running into a weird problem. When I do "python setup.py build", I get the following error:

gcc: src/_gtkagg.cpp
In file included from /usr/include/python2.3/Python.h:8,
                  from /usr/include/pygtk-2.0/pygobject.h:5,
                  from src/_gtkagg.cpp:11:
/usr/include/python2.3/pyconfig.h:850:1: warning: "_POSIX_C_SOURCE" redefined
In file included from /usr/include/string.h:26,
                  from /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/cstring:51,
                  from src/_gtkagg.cpp:2:
/usr/include/features.h:150:1: warning: this is the location of the previous definition
In file included from src/_gtkagg.cpp:11:
/usr/include/pygtk-2.0/pygobject.h:140: error: expected `,' or `...' before "typename"
/usr/include/pygtk-2.0/pygobject.h:147: error: expected `,' or `...' before "typename"
In file included from /usr/include/python2.3/Python.h:8,
                  from /usr/include/pygtk-2.0/pygobject.h:5,
                  from src/_gtkagg.cpp:11:
/usr/include/python2.3/pyconfig.h:850:1: warning: "_POSIX_C_SOURCE" redefined
In file included from /usr/include/string.h:26,
                  from /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/cstring:51,
                  from src/_gtkagg.cpp:2:
/usr/include/features.h:150:1: warning: this is the location of the previous definition
In file included from src/_gtkagg.cpp:11:
/usr/include/pygtk-2.0/pygobject.h:140: error: expected `,' or `...' before "typename"
/usr/include/pygtk-2.0/pygobject.h:147: error: expected `,' or `...' before "typename"

  So I did a google search, and found someone recommending that "#include <Python.h>" be prepended to the offending file. I have prepended it to src/_gtkagg.cpp, did a clean, and run the build again. The error changed, and the "_POSIX_C_SOURCE" problem went away, but the build is still failing, at that same file:

gcc: src/_gtkagg.cpp
In file included from src/_gtkagg.cpp:11:
/usr/include/pygtk-2.0/pygobject.h:140: error: expected `,' or `...' before "typename"
/usr/include/pygtk-2.0/pygobject.h:147: error: expected `,' or `...' before "typename"
In file included from src/_gtkagg.cpp:11:
/usr/include/pygtk-2.0/pygobject.h:140: error: expected `,' or `...' before "typename"
/usr/include/pygtk-2.0/pygobject.h:147: error: expected `,' or `...' before "typename"

  Does anyone have an idea of what is going wrong here? I could really use some help, as I am totally stumped.

  Many thanks in advance.

Victor Danilchenko wrote:

  Hi all,

  I am trying to build Matplotlib 0.87.7 on an RHEL 4.4-derived system, with Python 2.3.4. I am running into a weird problem. When I do "python setup.py build", I get the following error:

gcc: src/_gtkagg.cpp
In file included from /usr/include/python2.3/Python.h:8,
                  from /usr/include/pygtk-2.0/pygobject.h:5,
                  from src/_gtkagg.cpp:11:
/usr/include/python2.3/pyconfig.h:850:1: warning: "_POSIX_C_SOURCE" redefined
In file included from /usr/include/string.h:26,
                  from /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../../include/c++/3.4.6/cstring:51,
                  from src/_gtkagg.cpp:2:
/usr/include/features.h:150:1: warning: this is the location of the previous definition
In file included from src/_gtkagg.cpp:11:
/usr/include/pygtk-2.0/pygobject.h:140: error: expected `,' or `...' before "typename"
/usr/include/pygtk-2.0/pygobject.h:147: error: expected `,' or `...' before "typename"

[...]

The error is not in matplotlib, it is in a pygtk header file, which is presumably coming from a Redhat package. I don't know why it is happening or what the best solution is, though. It looks like the pygobject.h that I have has "typename_", not "typename", so I am thinking maybe this is a pygtk bug, since fixed, in which "typename" is in conflict with something. You might try editing your copy of pygobject.h, adding the trailing underscore to "typename" on both lines where it occurs. It can't hurt; these are just dummy variable names.

Eric

The error is not in matplotlib, it is in a pygtk header file, which is
presumably coming from a Redhat package. I don't know why it is

  True.

happening or what the best solution is, though. It looks like the
pygobject.h that I have has "typename_", not "typename", so I am
thinking maybe this is a pygtk bug, since fixed, in which "typename" is
in conflict with something.

  C++, typename is a reserved word there.

  You might try editing your copy of

pygobject.h, adding the trailing underscore to "typename" on both lines
where it occurs. It can't hurt; these are just dummy variable names.

  That is the solution, and you say the same that was adopted by the
project to solve the problem.

···

On 28/10/06, Eric Firing <efiring@...202...> wrote:

Eric

--
José Abílio