Building from source on Mac OS X

I'm attempting to build matplotlib from source (0.99.0 from sourceforge) on Mac OS 10.5, and I'm getting the build output below (with errors). Is there some setting I need to make for the mac OS backend?

--Mike

···

============================================================================
BUILDING MATPLOTLIB
             matplotlib: 0.99.0
                 python: 2.5.4 |EPD_Py25 4.3.0| (r254:67916, May 17 2009,
                         20:07:12) [GCC 4.0.1 (Apple Computer, Inc. build
                         5370)]
               platform: darwin

REQUIRED DEPENDENCIES
                  numpy: 1.3.0
              freetype2: 9.20.3

OPTIONAL BACKEND DEPENDENCIES
                 libpng: 1.2.37
                Tkinter: Tkinter: 67737, Tk: 8.4, Tcl: 8.4
               wxPython: 2.8.7.1
                         * WxAgg extension not required for wxPython >= 2.8
                   Gtk+: no
                         * Building for Gtk+ requires pygtk; you must be able
                         * to "import gtk" in your build/install environment
        Mac OS X native: yes
                     Qt: no
                    Qt4: no
                  Cairo: no

OPTIONAL DATE/TIMEZONE DEPENDENCIES
               datetime: present, version unknown
               dateutil: 1.4
                   pytz: 2008c

OPTIONAL USETEX DEPENDENCIES
                 dvipng: no
            ghostscript: 8.54
                  latex: no

[Edit setup.cfg to suppress the above messages]

pymods ['pylab']
packages ['matplotlib', 'matplotlib.backends', 'matplotlib.projections', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid', 'matplotlib.sphinxext', 'matplotlib.numerix', 'matplotlib.numerix.mlab', 'matplotlib.numerix.ma', 'matplotlib.numerix.linear_algebra', 'matplotlib.numerix.random_array', 'matplotlib.numerix.fft', 'matplotlib.delaunay']
running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc -> build/lib.macosx-10.3-fat-2.5/matplotlib/mpl-data
copying lib/matplotlib/mpl-data/matplotlib.conf -> build/lib.macosx-10.3-fat-2.5/matplotlib/mpl-data
running build_ext
building 'matplotlib.backends._macosx' extension
creating build/temp.macosx-10.3-fat-2.5
creating build/temp.macosx-10.3-fat-2.5/src
creating build/temp.macosx-10.3-fat-2.5/CXX
gcc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -O3 -I/tmp/_py/libraries/usr/local/include -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -I/Library/Frameworks/Python.framework/Versions/4.3.0/lib/python2.5/site-packages/numpy-1.3.0n1-py2.5-macosx-10.3-fat.egg/numpy/core/include -I/usr/local/include -I/usr/include -I/sw/include -I. -I/Library/Frameworks/Python.framework/Versions/4.3.0/lib/python2.5/site-packages/numpy-1.3.0n1-py2.5-macosx-10.3-fat.egg/numpy/core/include -Isrc -Iagg24/include -I. -I/Library/Frameworks/Python.framework/Versions/4.3.0/include/python2.5 -c src/_macosx.m -o build/temp.macosx-10.3-fat-2.5/src/_macosx.o
src/_macosx.m:1885: error: syntax error before ‘setfont’
src/_macosx.m: In function ‘setfont’:
src/_macosx.m:1895: error: ‘CTFontRef’ undeclared (first use in this function)
src/_macosx.m:1895: error: (Each undeclared identifier is reported only once
src/_macosx.m:1895: error: for each function it appears in.)
src/_macosx.m:1895: error: syntax error before ‘font’
src/_macosx.m:2095: error: ‘font’ undeclared (first use in this function)
src/_macosx.m: In function ‘GraphicsContext_draw_text’:
src/_macosx.m:2138: error: ‘CTFontRef’ undeclared (first use in this function)
src/_macosx.m:2138: error: syntax error before ‘font’
src/_macosx.m:2163: error: ‘font’ undeclared (first use in this function)
src/_macosx.m:2168: warning: assignment makes pointer from integer without a cast
src/_macosx.m:2170: error: ‘kCTFontAttributeName’ undeclared (first use in this function)
src/_macosx.m:2171: error: ‘kCTForegroundColorAttributeName’ undeclared (first use in this function)
src/_macosx.m:2191: error: ‘CTLineRef’ undeclared (first use in this function)
src/_macosx.m:2191: error: syntax error before ‘line’
src/_macosx.m:2194: error: ‘line’ undeclared (first use in this function)
src/_macosx.m: In function ‘GraphicsContext_get_text_width_height_descent’:
src/_macosx.m:2238: error: ‘CTFontRef’ undeclared (first use in this function)
src/_macosx.m:2238: error: syntax error before ‘font’
src/_macosx.m:2251: error: ‘font’ undeclared (first use in this function)
src/_macosx.m:2256: error: ‘kCTFontAttributeName’ undeclared (first use in this function)
src/_macosx.m:2274: error: ‘CTLineRef’ undeclared (first use in this function)
src/_macosx.m:2274: error: syntax error before ‘line’
src/_macosx.m:2277: error: ‘line’ undeclared (first use in this function)
src/_macosx.m:2285: error: incompatible types in assignment
error: command 'gcc' failed with exit status 1

I've just started getting exactly the same errors, but with Python 2.6.2 and the most recent svn checkout. I haven't updated for a month or so but never had this issue before.

Toby

···

On 20 Aug 2009, at 16:33, Michael Hearne wrote:

I'm attempting to build matplotlib from source (0.99.0 from
sourceforge) on Mac OS 10.5, and I'm getting the build output below
(with errors). Is there some setting I need to make for the mac OS
backend?

--Mike

=

BUILDING MATPLOTLIB
            matplotlib: 0.99.0
                python: 2.5.4 |EPD_Py25 4.3.0| (r254:67916, May 17
2009,
                        20:07:12) [GCC 4.0.1 (Apple Computer, Inc.
build
                        5370)]
              platform: darwin

REQUIRED DEPENDENCIES
                 numpy: 1.3.0
             freetype2: 9.20.3

OPTIONAL BACKEND DEPENDENCIES
                libpng: 1.2.37
               Tkinter: Tkinter: 67737, Tk: 8.4, Tcl: 8.4
              wxPython: 2.8.7.1
                        * WxAgg extension not required for wxPython

= 2.8

                  Gtk+: no
                        * Building for Gtk+ requires pygtk; you must
be able
                        * to "import gtk" in your build/install
environment
       Mac OS X native: yes
                    Qt: no
                   Qt4: no
                 Cairo: no

OPTIONAL DATE/TIMEZONE DEPENDENCIES
              datetime: present, version unknown
              dateutil: 1.4
                  pytz: 2008c

OPTIONAL USETEX DEPENDENCIES
                dvipng: no
           ghostscript: 8.54
                 latex: no

[Edit setup.cfg to suppress the above messages]

========================================================================
pymods ['pylab']
packages ['matplotlib', 'matplotlib.backends',
'matplotlib.projections', 'mpl_toolkits', 'mpl_toolkits.mplot3d',
'mpl_toolkits.axes_grid', 'matplotlib.sphinxext',
'matplotlib.numerix', 'matplotlib.numerix.mlab',
'matplotlib.numerix.ma', 'matplotlib.numerix.linear_algebra',
'matplotlib.numerix.random_array', 'matplotlib.numerix.fft',
'matplotlib.delaunay']
running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc -> build/lib.macosx-10.3-
fat-2.5/matplotlib/mpl-data
copying lib/matplotlib/mpl-data/matplotlib.conf -> build/
lib.macosx-10.3-fat-2.5/matplotlib/mpl-data
running build_ext
building 'matplotlib.backends._macosx' extension
creating build/temp.macosx-10.3-fat-2.5
creating build/temp.macosx-10.3-fat-2.5/src
creating build/temp.macosx-10.3-fat-2.5/CXX
gcc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-
aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -
dynamic -DNDEBUG -g -O3 -I/tmp/_py/libraries/usr/local/include -
DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -I/Library/Frameworks/
Python.framework/Versions/4.3.0/lib/python2.5/site-packages/
numpy-1.3.0n1-py2.5-macosx-10.3-fat.egg/numpy/core/include -I/usr/
local/include -I/usr/include -I/sw/include -I. -I/Library/Frameworks/
Python.framework/Versions/4.3.0/lib/python2.5/site-packages/
numpy-1.3.0n1-py2.5-macosx-10.3-fat.egg/numpy/core/include -Isrc -
Iagg24/include -I. -I/Library/Frameworks/Python.framework/Versions/
4.3.0/include/python2.5 -c src/_macosx.m -o build/temp.macosx-10.3-
fat-2.5/src/_macosx.o
src/_macosx.m:1885: error: syntax error before ‘setfont’
src/_macosx.m: In function ‘setfont’:
src/_macosx.m:1895: error: ‘CTFontRef’ undeclared (first use in this
function)
src/_macosx.m:1895: error: (Each undeclared identifier is reported
only once
src/_macosx.m:1895: error: for each function it appears in.)
src/_macosx.m:1895: error: syntax error before ‘font’
src/_macosx.m:2095: error: ‘font’ undeclared (first use in this
function)
src/_macosx.m: In function ‘GraphicsContext_draw_text’:
src/_macosx.m:2138: error: ‘CTFontRef’ undeclared (first use in this
function)
src/_macosx.m:2138: error: syntax error before ‘font’
src/_macosx.m:2163: error: ‘font’ undeclared (first use in this
function)
src/_macosx.m:2168: warning: assignment makes pointer from integer
without a cast
src/_macosx.m:2170: error: ‘kCTFontAttributeName’ undeclared (first
use in this function)
src/_macosx.m:2171: error: ‘kCTForegroundColorAttributeName’
undeclared (first use in this function)
src/_macosx.m:2191: error: ‘CTLineRef’ undeclared (first use in this
function)
src/_macosx.m:2191: error: syntax error before ‘line’
src/_macosx.m:2194: error: ‘line’ undeclared (first use in this
function)
src/_macosx.m: In function
‘GraphicsContext_get_text_width_height_descent’:
src/_macosx.m:2238: error: ‘CTFontRef’ undeclared (first use in this
function)
src/_macosx.m:2238: error: syntax error before ‘font’
src/_macosx.m:2251: error: ‘font’ undeclared (first use in this
function)
src/_macosx.m:2256: error: ‘kCTFontAttributeName’ undeclared (first
use in this function)
src/_macosx.m:2274: error: ‘CTLineRef’ undeclared (first use in this
function)
src/_macosx.m:2274: error: syntax error before ‘line’
src/_macosx.m:2277: error: ‘line’ undeclared (first use in this
function)
src/_macosx.m:2285: error: incompatible types in assignment
error: command 'gcc' failed with exit status 1

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options

Hi,
I've been having the same problem. I've done some digging and now know why this is happening, but have no idea how to fix it! Someone has updated _macosx.m to use the new CTFont functionality in the 10.5 SDK. Unfortunately, the #ifdef checks they have put in to ensure that the 10.5 SDK is being used don't seem to work properly, and the matplotlib build process specifies the 10.4 SDK. Currently the checks are done using:
#ifdef MAC_OS_X_VERSION_10_5
but if you are building on 10.5 this seems to always be defined, even with the SDK specified to 10.4. I've spent a while reading through the Apple docs but have to admit I'm a little mystified as to how to properly check for the SDK version.
Out of curiosity, why is the 10.4 SDK specified and how? Is this part of distutils? And why, even with the 10.4 SDK, is the resulting output bundle called 10.3 fat?
Toby

···

On 20 Aug 2009, at 16:33, Michael Hearne wrote:

I'm attempting to build matplotlib from source (0.99.0 from
sourceforge) on Mac OS 10.5, and I'm getting the build output below
(with errors). Is there some setting I need to make for the mac OS
backend?

--Mike

=

BUILDING MATPLOTLIB
            matplotlib: 0.99.0
                python: 2.5.4 |EPD_Py25 4.3.0| (r254:67916, May 17
2009,
                        20:07:12) [GCC 4.0.1 (Apple Computer, Inc.
build
                        5370)]
              platform: darwin

REQUIRED DEPENDENCIES
                 numpy: 1.3.0
             freetype2: 9.20.3

OPTIONAL BACKEND DEPENDENCIES
                libpng: 1.2.37
               Tkinter: Tkinter: 67737, Tk: 8.4, Tcl: 8.4
              wxPython: 2.8.7.1
                        * WxAgg extension not required for wxPython

= 2.8

                  Gtk+: no
                        * Building for Gtk+ requires pygtk; you must
be able
                        * to "import gtk" in your build/install
environment
       Mac OS X native: yes
                    Qt: no
                   Qt4: no
                 Cairo: no

OPTIONAL DATE/TIMEZONE DEPENDENCIES
              datetime: present, version unknown
              dateutil: 1.4
                  pytz: 2008c

OPTIONAL USETEX DEPENDENCIES
                dvipng: no
           ghostscript: 8.54
                 latex: no

[Edit setup.cfg to suppress the above messages]

========================================================================
pymods ['pylab']
packages ['matplotlib', 'matplotlib.backends',
'matplotlib.projections', 'mpl_toolkits', 'mpl_toolkits.mplot3d',
'mpl_toolkits.axes_grid', 'matplotlib.sphinxext',
'matplotlib.numerix', 'matplotlib.numerix.mlab',
'matplotlib.numerix.ma', 'matplotlib.numerix.linear_algebra',
'matplotlib.numerix.random_array', 'matplotlib.numerix.fft',
'matplotlib.delaunay']
running build
running build_py
copying lib/matplotlib/mpl-data/matplotlibrc -> build/lib.macosx-10.3-
fat-2.5/matplotlib/mpl-data
copying lib/matplotlib/mpl-data/matplotlib.conf -> build/
lib.macosx-10.3-fat-2.5/matplotlib/mpl-data
running build_ext
building 'matplotlib.backends._macosx' extension
creating build/temp.macosx-10.3-fat-2.5
creating build/temp.macosx-10.3-fat-2.5/src
creating build/temp.macosx-10.3-fat-2.5/CXX
gcc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-
aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -
dynamic -DNDEBUG -g -O3 -I/tmp/_py/libraries/usr/local/include -
DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -I/Library/Frameworks/
Python.framework/Versions/4.3.0/lib/python2.5/site-packages/
numpy-1.3.0n1-py2.5-macosx-10.3-fat.egg/numpy/core/include -I/usr/
local/include -I/usr/include -I/sw/include -I. -I/Library/Frameworks/
Python.framework/Versions/4.3.0/lib/python2.5/site-packages/
numpy-1.3.0n1-py2.5-macosx-10.3-fat.egg/numpy/core/include -Isrc -
Iagg24/include -I. -I/Library/Frameworks/Python.framework/Versions/
4.3.0/include/python2.5 -c src/_macosx.m -o build/temp.macosx-10.3-
fat-2.5/src/_macosx.o
src/_macosx.m:1885: error: syntax error before ‘setfont’
src/_macosx.m: In function ‘setfont’:
src/_macosx.m:1895: error: ‘CTFontRef’ undeclared (first use in this
function)
src/_macosx.m:1895: error: (Each undeclared identifier is reported
only once
src/_macosx.m:1895: error: for each function it appears in.)
src/_macosx.m:1895: error: syntax error before ‘font’
src/_macosx.m:2095: error: ‘font’ undeclared (first use in this
function)
src/_macosx.m: In function ‘GraphicsContext_draw_text’:
src/_macosx.m:2138: error: ‘CTFontRef’ undeclared (first use in this
function)
src/_macosx.m:2138: error: syntax error before ‘font’
src/_macosx.m:2163: error: ‘font’ undeclared (first use in this
function)
src/_macosx.m:2168: warning: assignment makes pointer from integer
without a cast
src/_macosx.m:2170: error: ‘kCTFontAttributeName’ undeclared (first
use in this function)
src/_macosx.m:2171: error: ‘kCTForegroundColorAttributeName’
undeclared (first use in this function)
src/_macosx.m:2191: error: ‘CTLineRef’ undeclared (first use in this
function)
src/_macosx.m:2191: error: syntax error before ‘line’
src/_macosx.m:2194: error: ‘line’ undeclared (first use in this
function)
src/_macosx.m: In function
‘GraphicsContext_get_text_width_height_descent’:
src/_macosx.m:2238: error: ‘CTFontRef’ undeclared (first use in this
function)
src/_macosx.m:2238: error: syntax error before ‘font’
src/_macosx.m:2251: error: ‘font’ undeclared (first use in this
function)
src/_macosx.m:2256: error: ‘kCTFontAttributeName’ undeclared (first
use in this function)
src/_macosx.m:2274: error: ‘CTLineRef’ undeclared (first use in this
function)
src/_macosx.m:2274: error: syntax error before ‘line’
src/_macosx.m:2277: error: ‘line’ undeclared (first use in this
function)
src/_macosx.m:2285: error: incompatible types in assignment
error: command 'gcc' failed with exit status 1

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options