On 06/ 9/10 07:04 PM, John Hunter wrote:
On Wed, Jun 9, 2010 at 9:25 AM, Dr. David Kirkby
<[email protected]>  wrote:

Thank you. I noticed on package (Singular) where CPPFLAGS was not set to
$SAGE_LOCAL/include, and doing so ensured the include files in Sage were
found. I've not tried this with Matplotlib, but it might be a way to work
around the problem if there is no configure option to specify the location
of freetype.

The mpl configure happens in setupext.py that lives next to setup.py.
It tries to use pkgconfig if it is available to find freetype, so you
may have luck setting your PKG_CONFIG_PATH if you are using it.

I was not using PKG_CONFIG_PATH

Would it be a good idea in general to set PKG_CONFIG_PATH to a directory in Sage? I'm not sure if it would need to be $SAGE_LOCAL, $SAGE_LOCAL/lib, or $SAGE_LOCAL/lib/pkgconfig.

I would have thought that it sensible to prepend the required Sage directory to PKG_CONFIG_PATH, in much the same way as $SAGE_LOCAL/bin is prepended to PATH and $SAGE_LOCAL/lib is prepended to LD_LIBRARY_PATH. At the moment, that is not happening in Sage, despite there being several configuration files in the directory $SAGE_LOCAL/lib/pkgconfig.

What I can't understand is how /usr/sfw/include/freetype2 was found though. There was certainly no PKG_CONFIG_PATH set to anything like /usr/sfw, though /usr/sfw/bin was in my path, and there is a directory /usr/sfw/lib/pkgconfig

So how did matplotlib find the freetype headers in /usr/sfw/include?

There is a file /usr/sfw/bin/freetype-config which I thought might have been the culprit.


Alternatively, there is a dictionary in setupext.py called basedirs
that maps platform to list of directories to search for support libs.
You might want to modify the defaults to find the directory containing
the sage supplied versions.

JDH

At the moment, setupext.py is patched in Sage to:

sage_inc = os.environ['SAGE_LOCAL'] + '/include/'
sage_lib = os.environ['SAGE_LOCAL'] + '/lib/'

basedir = {
    'win32'  : ['win32_static',],
    'linux2' : [sage_lib],
    'linux'  : ['/usr/local', '/usr',],
    'cygwin' : ['/usr/local', '/usr',],
    '_darwin' : ['/sw/lib/freetype2', '/sw/lib/freetype219', '/usr/local',
                '/usr', '/sw'],
    # it appears builds with darwin are broken because of all the
    # different flags the deps can be compile with, so I am pushing
    # people to :
    #   make -f make.osx fetch deps mpl_build mpl_install

    'darwin' : [sage_lib],

    'freebsd4' : ['/usr/local', '/usr'],
    'freebsd5' : ['/usr/local', '/usr'],
    'freebsd6' : ['/usr/local', '/usr'],
    'sunos5' : [os.getenv('MPLIB_BASE') or '/usr/local',],
    'gnukfreebsd5' : ['/usr/local', '/usr'],
    'gnukfreebsd6' : ['/usr/local', '/usr'],
    'aix5' : ['/usr/local'],
}

So sage_lib is used on linux, but not Solaris. Does that make any sense even on Linux - forget Solaris for a minute? Given all the other directories in the 'basedir' list do *not* end in "lib", I can't see why the one for Linux should have substiuted $SAGE_LOCAL/lib. It would seem more logical for it to be $SAGE_LOCAL and not $SAGE_LOCAL/lib.

Anyway, given all the above, what would seem most logical to put on that 'sunos5' line, which is the one that is relevant here, since that is what python is indicating.


drkir...@hawk:~$ python
Python 2.6.4 (r264:75706, Feb 14 2010, 14:03:47) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.platform
'sunos5'
>>>


Dave

--
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to