building matplotlib with homebrew python and XQuartz 2.7.5

I’m trying to get matplotlib working with the following setup on OSX 10.9.3

rail:~ brew$ gcc --version

gcc (GCC) 4.8.2

rail:~ brew$ python --version

Python 2.7.6

pip install git+git://github.com/matplotlib/matplotlib.git (as of today at 11am PDT)

Problem 1: couldn’t find a freetype header – googling supplied the fix:

sudo ln -s /usr/X11/include/freetype2/freetype /usr/X11/include/.

per http://stackoverflow.com/questions/19697457/numpy-matplotlib-install-error-ftheader-h-no-such-file-or-directory

Problem 2: I’m getting a fatal syntax error in _macosx.m:

/usr/local/bin/gcc -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_backends__macosx_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include -I/usr/local/include -I/usr/include -I/usr/X11/include -I. -Iextern/agg24/include -Iextern -I/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/_macosx.m -o build/temp.macosx-10.8-x86_64-2.7/src/_macosx.o

In file included from /usr/include/Availability.h:148:0,

from /usr/local/Cellar/gcc/4.8.2_1/lib/gcc/x86_64-apple-darwin13.2.0/4.8.2/include-fixed/math.h:46,

from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:19,

from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,

from /System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12,

from src/_macosx.m:1:

/System/Library/Frameworks/Foundation.framework/Headers/NSUserNotification.h:16:45: error: expected ‘,’ or ‘}’ before ‘attribute

NSUserNotificationActivationTypeReplied NS_AVAILABLE(10_9, NA) = 3

thanks in advance for suggestions on how to proceed – Phil

Any reason you’re trying to compile with gcc? I think most of the homebrew build recipes are tested using clang.

···

On Thu, May 22, 2014 at 12:07 PM, lecture notes <mkpaustin@…149…> wrote:

I’m trying to get matplotlib working with the following setup on OSX 10.9.3

rail:~ brew$ gcc --version

gcc (GCC) 4.8.2

rail:~ brew$ python --version

Python 2.7.6

pip install git+git://github.com/matplotlib/matplotlib.git (as of today at 11am PDT)

Problem 1: couldn’t find a freetype header – googling supplied the fix:

sudo ln -s /usr/X11/include/freetype2/freetype /usr/X11/include/.

per http://stackoverflow.com/questions/19697457/numpy-matplotlib-install-error-ftheader-h-no-such-file-or-directory

Problem 2: I’m getting a fatal syntax error in _macosx.m:

/usr/local/bin/gcc -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_backends__macosx_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include -I/usr/local/include -I/usr/include -I/usr/X11/include -I. -Iextern/agg24/include -Iextern -I/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/_macosx.m -o build/temp.macosx-10.8-x86_64-2.7/src/_macosx.o

In file included from /usr/include/Availability.h:148:0,

from /usr/local/Cellar/gcc/4.8.2_1/lib/gcc/x86_64-apple-darwin13.2.0/4.8.2/include-fixed/math.h:46,

from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:19,

from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,

from /System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12,

from src/_macosx.m:1:

/System/Library/Frameworks/Foundation.framework/Headers/NSUserNotification.h:16:45: error: expected ‘,’ or ‘}’ before ‘attribute

NSUserNotificationActivationTypeReplied NS_AVAILABLE(10_9, NA) = 3

thanks in advance for suggestions on how to proceed – Phil


"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE

Instantly run your Selenium tests across 300+ browser/OS combos.

Get unparalleled scalability from the best Selenium testing platform available

Simple to use. Nothing to install. Get started now for free."

http://p.sf.net/sfu/SauceLabs


Matplotlib-devel mailing list

Matplotlib-devel@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Thanks, that worked. (I had CC=gcc to keep things compatible with linux).

For anyone coming to this thread with the same error, note that you also need to do

export CC=/usr/bin/clang

export FC-=/usr/local/bin/fortran

to get

pip install scipy

to work.

···

On Thu, May 22, 2014 at 12:10 PM, Nathan Goldbaum <nathan12343@…149…> wrote:

Any reason you’re trying to compile with gcc? I think most of the homebrew build recipes are tested using clang.