[Pythonmac-SIG] Re: matplotlib OS-X binary problems.

The question is: Can I build a binary version that will

    > work with all the back ends, if they are there, but also
    > work on what is there if they aren't all. This comes down
    > to when the linking happens, I guess. Experimentation will
    > answer this for me, but I welcome and insight any of you
    > may have.

    > One issue that has come up is libfreetype. If you have GTK,
    > you have X11, so you have libfreetype. Indeed, I don't have
    > GTK, but I do have X11, and the X11 freetype got linked to
    > my package. I can probably fix this by removing
    > "/usr/X11R6" from the basedir list for darwin. Then I'll
    > have libfreetype statically linked to matplotlib, but
    > PyGTK, if the user has it, will have a different version
    > dynamically linked. Is this going to cause problems?

Here is what I do for the win32 which has some related issues.

matplotlib needs Tkinter and pygtk to be installed on your build
system in order to build the matplotlib extension code for those
modules. But you do not need to statically link in any gtk or tk
library code.

I do statically link png, freetype and zlib for win32 so that users
don't have to install any of those prereqs.

Then they get a package that has Agg, PS, SVG out of the box
regardless of their system. If they have pygtk on their system, they
also get GTK and GTKAgg. If they have Tkinter, they also get
TkAgg. If they have wxpython, they also get WX, WXAgg.

The key is, if you want your package to be maximally usable, you
should have pygtk and tk (and the requisite devel stuff) and should
probably statically link freetype, png and zlib.

Of course there is now also a Cairo and GTKCairo backend, which may
interest some OSX X11 users, but I haven't had to worry about this for
win32 users.

And FLTK and QT ..., but we can save that for another day. I think if you
have the tkagg extension compiled in, most OSX people will be happy
with either that or wxagg.


John Hunter wrote:

I do statically link png, freetype and zlib for win32 so that users
don't have to install any of those prereqs.

Thanks John, I have a plan now.

I have a question, however. How do I get distutils to statically link a given lib? the only method I have now is to make sure that only the static lib is available. I can do that (for the moment) with libpng, but for freetype, I have a problem. In setupext.py, there is:

basedir = {
     'darwin' : ['/usr/local', '/usr', '/sw', '/usr/X11R6'],

There is a libfreetype in /usr/X11R6, but only if X11 is installed, so I don't want to use it. However, I imagine that /usr/X11R6 is required to the GTK build, so I can't take that out. Any ideas?

I notice that for win32, you have only:

basedir = {
     'win32' : ['win32_static',],

Should I do that for darwin, and put my static libs in there?

I'm off to try some of this.



Christopher Barker, Ph.D.
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception