Cannot build matplotlib-0.63.4

Hi, I cannot build matplotlib-0.63.4 on gentoo linux. The

    > error I get when running python setup.py build is:

    > running build_ext building 'matplotlib._na_transforms'
    > extension creating build/temp.linux-i686-2.3 creating
    > build/temp.linux-i686-2.3/src creating
    > build/temp.linux-i686-2.3/CXX gcc -fno-strict-aliasing
    > -DNDEBUG -fPIC -Isrc -I. -I/usr/include/python2.3 -c
    > CXX/IndirectPythonInterface.cxx -o
    > build/temp.linux-i686-2.3/CXX/IndirectPythonInterface.o
    > -DNUMARRAY=1 gcc -fno-strict-aliasing -DNDEBUG -fPIC -Isrc
    > -I. -I/usr/include/python2.3 -c CXX/cxxsupport.cxx -o
    > build/temp.linux-i686-2.3/CXX/cxxsupport.o -DNUMARRAY=1 In
    > file included from CXX/cxxsupport.cxx:6: ./CXX/Objects.hxx:
    > In constructor
    > `Py::MapBase<T>::const_iterator::const_iterator(const
    > Py::MapBase<T>*, Py::List,
    > Py::SeqBase<Py::Object>::iterator)':
    > ./CXX/Objects.hxx:2271: error: `s' undeclared (first use
    > this function) ./CXX/Objects.hxx:2271: error: (Each
    > undeclared identifier is reported only once for each
    > function it appears in.) error: command 'gcc' failed with
    > exit status 1

    > I have python 2.3.3, GCC 3.4.2, Numeric 23.3, numarray 1.0,
    > pygtk-2.3.97 (I ungraded from pygtk-2.2.0 but that did not
    > help), and wxpython-2.4.2.4

    > I hope that is enough information - do I have the wrong
    > versions - or am I missing something - I had no trouble
    > building matplotlib-0.62.x

From a very quick read of the cxx code in that region, it looks like a
cxx bug. I don't know why it is only exposed in gcc 3.4.2. Try
replacing the function in line 2270 of CXX/Objects.hxx with

       const_iterator (const MapBase<T>* m, List k, List::iterator p )
           : map(m), keys(k), pos(p)
           {}

map(s) has been replaced by map(m).

The cxx code was not written by me, but this looks like a clear bug.

JDH

Thanks very much.

It worked - (mostly)
I made the change you suggested and resolved that error - unfortunately it
still did not build with pygtk-2.3.97 so I replaced that with pygtk-2.2.0 and
it worked. Below is the error I got with pygtk-2.3.97 - it appears to be the
same as an error reported already on matplotlib-users under the title
'[Matplotlib-users] matplotlib and pygtk 2.3.96'. It seems that in that case
upgrading to pygtk-2.3.97 helped, but here it did not. But I have a working
matplotlib and I don't really care what version of pygtk I have to that is
fine for me.

building 'matplotlib.backends._gtkagg' extension
gcc -fno-strict-aliasing -DNDEBUG -fPIC -I/usr/local/include -I/usr/include
-Isrc -Iagg22/include -I. -I/usr/local/include -I/usr/include
-I/usr/local/include/freetype2 -I/usr/include/freetype2 -Isrc/freetype2
-Iagg22/include/freetype2 -I./freetype2 -I/usr/local/include/freetype2
-I/usr/include/freetype2 -I/usr/local/include -I/usr/include
-I/usr/include/pygtk-2.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include
-I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2
-I/usr/include/freetype2/config -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -I/usr/include/python2.3 -c src/_gtkagg.cpp -o
build/temp.linux-i686-2.3/src/_gtkagg.o
In file included from /usr/include/python2.3/Python.h:8,
                 from /usr/include/pygtk-2.0/pygobject.h:5,
                 from src/_gtkagg.cpp:8:
/usr/include/python2.3/pyconfig.h:847:1: warning: "_POSIX_C_SOURCE" redefined
In file included from /usr/include/string.h:26,
                 from /usr/lib/gcc/i686-pc-linux-gnu/3.4.2/include/g++-v3/cstring:51,
                 from src/_gtkagg.cpp:1:
/usr/include/features.h:131:1: warning: this is the location of the previous
definition
In file included from src/_gtkagg.cpp:8:
/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"
error: command 'gcc' failed with exit status 1

···

On Friday 01 October 2004 13:53, you wrote:

    > Hi, I cannot build matplotlib-0.63.4 on gentoo linux. The
    > error I get when running python setup.py build is:

    > running build_ext building 'matplotlib._na_transforms'
    > extension creating build/temp.linux-i686-2.3 creating
    > build/temp.linux-i686-2.3/src creating
    > build/temp.linux-i686-2.3/CXX gcc -fno-strict-aliasing
    > -DNDEBUG -fPIC -Isrc -I. -I/usr/include/python2.3 -c
    > CXX/IndirectPythonInterface.cxx -o
    > build/temp.linux-i686-2.3/CXX/IndirectPythonInterface.o
    > -DNUMARRAY=1 gcc -fno-strict-aliasing -DNDEBUG -fPIC -Isrc
    > -I. -I/usr/include/python2.3 -c CXX/cxxsupport.cxx -o
    > build/temp.linux-i686-2.3/CXX/cxxsupport.o -DNUMARRAY=1 In
    > file included from CXX/cxxsupport.cxx:6: ./CXX/Objects.hxx:
    > In constructor
    > `Py::MapBase<T>::const_iterator::const_iterator(const
    > Py::MapBase<T>*, Py::List,
    > Py::SeqBase<Py::Object>::iterator)':
    > ./CXX/Objects.hxx:2271: error: `s' undeclared (first use
    > this function) ./CXX/Objects.hxx:2271: error: (Each
    > undeclared identifier is reported only once for each
    > function it appears in.) error: command 'gcc' failed with
    > exit status 1

    > I have python 2.3.3, GCC 3.4.2, Numeric 23.3, numarray 1.0,
    > pygtk-2.3.97 (I ungraded from pygtk-2.2.0 but that did not
    > help), and wxpython-2.4.2.4

    > I hope that is enough information - do I have the wrong
    > versions - or am I missing something - I had no trouble
    > building matplotlib-0.62.x

From a very quick read of the cxx code in that region, it looks like a
cxx bug. I don't know why it is only exposed in gcc 3.4.2. Try
replacing the function in line 2270 of CXX/Objects.hxx with

       const_iterator (const MapBase<T>* m, List k, List::iterator p )

           : map(m), keys(k), pos(p)

           {}

map(s) has been replaced by map(m).

The cxx code was not written by me, but this looks like a clear bug.

JDH