0.87 on HP-UX 11.23/PA with Python 2.4.2

The problem is duplicate function names. An error occurs

    > because set_bg() is contained in more than one loadable
    > module, and the wrong one is selected at
    > runtime. examples/image_demo.py won't run because Python
    > gives an AttributeError in lib/matplotlib/image.py, line
    > 141: im.set_bg( *bg)

I'm confused here. The only extension code that defines set_bg is the
_image module

johnh@...324...:src> grep set_bg *.h
_image.h: Py::Object set_bg(const Py::Tuple& args);
_image.h: static char set_bg__doc__[];

I don't see why you should be having a problem with this. Can you
submit a complete traceback?

    > Also, src/mplutils.cpp is included multiple times but I
    > haven't encountered any errors because of this yet.

This shouldn't pose a problem as long as there isn't a global
variable, right? My understanding is that the ft2font problem arises
because of the use of the global FT_Library _ft2Library .

JDH

    > The problem is duplicate function names. An error occurs
    > because set_bg() is contained in more than one loadable
    > module, and the wrong one is selected at
    > runtime. examples/image_demo.py won't run because Python
    > gives an AttributeError in lib/matplotlib/image.py, line
    > 141: im.set_bg( *bg)

I'm confused here. The only extension code that defines set_bg is the
_image module

But src/_image.cpp is built into _n?_backend_agg.so and _n?_image.so.
We really don't want duplicate symbols in loadable modules if they
will be loaded at once.

johnh@...324...:src> grep set_bg *.h
_image.h: Py::Object set_bg(const Py::Tuple& args);
_image.h: static char set_bg__doc__[];

I don't see why you should be having a problem with this. Can you
submit a complete traceback?

$ python image_demo.py
Traceback (most recent call last):
  File "image_demo.py", line 14, in ?
    savefig('image_demo')
  File "/tmp/m/matplotlib/pylab.py", line 839, in savefig
    return fig.savefig(*args, **kwargs)
  File "/tmp/m/matplotlib/figure.py", line 654, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "/tmp/m/matplotlib/backends/backend_gtkagg.py", line 111, in print_figure
    agg.print_figure(filename, dpi, facecolor, edgecolor, orientation)
  File "/tmp/m/matplotlib/backends/backend_agg.py", line 447, in print_figure
    self.draw()
  File "/tmp/m/matplotlib/backends/backend_agg.py", line 384, in draw
    self.figure.draw(renderer)
  File "/tmp/m/matplotlib/figure.py", line 529, in draw
    for a in self.axes: a.draw(renderer)
  File "/tmp/m/matplotlib/axes.py", line 1420, in draw
    im.draw(renderer)
  File "/tmp/m/matplotlib/image.py", line 206, in draw
    im = self.make_image()
  File "/tmp/m/matplotlib/image.py", line 141, in make_image
    im.set_bg( *bg)
AttributeError: set_bg

The AttributeError is kinda odd though. If I print 'im', I get:
  <Image object at 0x40cdd374>

Regardless of whether or not Image is picked from _na_backend_agg.so
or _na_image.so, you'd think im.set_bg() would be available. However,
removing the duplicate src/_image.cpp file from being included in
_n?_backend_agg.so solved things.

    > Also, src/mplutils.cpp is included multiple times but I
    > haven't encountered any errors because of this yet.

This shouldn't pose a problem as long as there isn't a global
variable, right? My understanding is that the ft2font problem arises
because of the use of the global FT_Library _ft2Library .

_image.o is linked into _n?_backend_agg.so and _n?_image.so. Both will
be loaded at runtime.

I don't think the problem is limited to global variables. Rather, I'd
say duplicate symbols. According to one of the GCC developers (who
specializes in HP-UX/PA):
  When a weak symbol is linked into a shared library, it becomes a
  strong global symbol. So, if the symbol appears in more than one
  shared object, then you can can get the problem that you found. This
  is one area where the HP linker differs from the SYSV ABI. The other
  is in the handling of undefined weak symbols.

The default object file format on HP-UX/PA is SOM, not ELF. HP-UX/IA
is ELF and HP-UX/PA 64-bit is ELF.

···

On Mon, Feb 27, 2006 at 10:23:12AM -0600, John Hunter wrote:

--
albert chin (china@...319...)