Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails on OS X with NumPy 1.9 #2705

Merged
merged 1 commit into from Jan 14, 2014
Merged

Conversation

mdboom
Copy link
Member

@mdboom mdboom commented Jan 13, 2014

The current Matplotlib master fails to build against NumPy 1.9, also from master. I get the following:

/Library/Python/2.7/site-packages/numpy-1.9.0.dev_ff7d5f9-py2.7-macosx-10.9-intel.egg/numpy/core/include/numpy/npy_3kcompat.h:255: warning: deprecated conversion from string constant to ‘char*’
src/ft2font.cpp: In member function ‘Py::Object FT2Image::py_write_bitmap(const Py::Tuple&)’:
src/ft2font.cpp:195: warning: statement has no effect
src/ft2font.cpp: In function ‘void close_file_callback(FT_StreamRec_*)’:
src/ft2font.cpp:2144: warning: statement has no effect
src/ft2font.cpp: In member function ‘int FT2Font::make_open_args(PyObject*, FT_Open_Args*)’:
src/ft2font.cpp:2207: warning: deprecated conversion from string constant to ‘char*’
src/ft2font.cpp:2207: warning: deprecated conversion from string constant to ‘char*’
error: command 'gcc-4.2' failed with exit status 1

I generate new builds every couple of weeks, using the same script:

cd ../matplotlib
git pull
sudo rm -rf build dist
make -f make.custom binaries
sudo easy_install -Z -N dist/*egg
cp dist/*egg ../ScipySuperpack

This is the first time I have seen this failure. OS X 10.9.1, gcc 4.2.1.

@mdboom
Copy link
Member

mdboom commented Jan 6, 2014

Is that the entire error output? I don't see an error here, only warnings.

@fonnesbeck
Copy link
Author

Sorry, here should be everything of relevance:

gcc-4.2 -DNDEBUG -g -fwrapv -Os -Wall -I/Users/fonnescj/Code/include -I/Users/fonnescj/Code/include/freetype2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -pipe -arch x86_64 -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/Users/fonnescj/.virtualenvs/pymc2/lib/python2.7/site-packages/numpy-1.9.0.dev_ff7d5f9-py2.7-macosx-10.9-intel.egg/numpy/core/include -I/usr/local/Cellar/freetype/2.5.2/include/freetype2 -I/usr/local/include -I/usr/include -I/usr/X11/include -I. -Iextern -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/ft2font.cpp -o build/temp.macosx-10.9-intel-2.7/src/ft2font.o
In file included from /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:85,
                 from extern/CXX/WrapPython.h:58,
                 from extern/CXX/Extensions.hxx:37,
                 from src/ft2font.h:6,
                 from src/ft2font.cpp:3:
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:4:20: error: stdarg.h: No such file or directory
In file included from /Users/fonnescj/.virtualenvs/pymc2/lib/python2.7/site-packages/numpy-1.9.0.dev_ff7d5f9-py2.7-macosx-10.9-intel.egg/numpy/core/include/numpy/ndarraytypes.h:1760,
                 from /Users/fonnescj/.virtualenvs/pymc2/lib/python2.7/site-packages/numpy-1.9.0.dev_ff7d5f9-py2.7-macosx-10.9-intel.egg/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /Users/fonnescj/.virtualenvs/pymc2/lib/python2.7/site-packages/numpy-1.9.0.dev_ff7d5f9-py2.7-macosx-10.9-intel.egg/numpy/core/include/numpy/npy_3kcompat.h:23,
                 from src/file_compat.h:4,
                 from src/ft2font.cpp:7:
/Users/fonnescj/.virtualenvs/pymc2/lib/python2.7/site-packages/numpy-1.9.0.dev_ff7d5f9-py2.7-macosx-10.9-intel.egg/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/iosfwd:45,
                 from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/bits/stl_algobase.h:70,
                 from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/bits/char_traits.h:46,
                 from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/string:47,
                 from extern/CXX/Python2/Exception.hxx:46,
                 from extern/CXX/Exception.hxx:40,
                 from extern/CXX/Python2/Objects.hxx:44,
                 from extern/CXX/Python2/Extensions.hxx:52,
                 from extern/CXX/Extensions.hxx:40,
                 from src/ft2font.h:6,
                 from src/ft2font.cpp:3:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/bits/c++locale.h: In function ‘int std::__convert_from_v(int* const&, char*, int, const char*, ...)’:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/bits/c++locale.h:77: error: ‘va_start’ was not declared in this scope
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/bits/c++locale.h:85: error: ‘va_end’ was not declared in this scope
In file included from src/file_compat.h:4,
                 from src/ft2font.cpp:7:
/Users/fonnescj/.virtualenvs/pymc2/lib/python2.7/site-packages/numpy-1.9.0.dev_ff7d5f9-py2.7-macosx-10.9-intel.egg/numpy/core/include/numpy/npy_3kcompat.h: In function ‘PyObject* npy_PyFile_OpenFile(PyObject*, const char*)’:
/Users/fonnescj/.virtualenvs/pymc2/lib/python2.7/site-packages/numpy-1.9.0.dev_ff7d5f9-py2.7-macosx-10.9-intel.egg/numpy/core/include/numpy/npy_3kcompat.h:247: warning: deprecated conversion from string constant to ‘char*’
/Users/fonnescj/.virtualenvs/pymc2/lib/python2.7/site-packages/numpy-1.9.0.dev_ff7d5f9-py2.7-macosx-10.9-intel.egg/numpy/core/include/numpy/npy_3kcompat.h: In function ‘int npy_PyFile_CloseFile(PyObject*)’:
/Users/fonnescj/.virtualenvs/pymc2/lib/python2.7/site-packages/numpy-1.9.0.dev_ff7d5f9-py2.7-macosx-10.9-intel.egg/numpy/core/include/numpy/npy_3kcompat.h:255: warning: deprecated conversion from string constant to ‘char*’
src/ft2font.cpp: In member function ‘Py::Object FT2Image::py_write_bitmap(const Py::Tuple&)’:
src/ft2font.cpp:195: warning: statement has no effect
src/ft2font.cpp: In function ‘void close_file_callback(FT_StreamRec_*)’:
src/ft2font.cpp:2144: warning: statement has no effect
src/ft2font.cpp: In member function ‘int FT2Font::make_open_args(PyObject*, FT_Open_Args*)’:
src/ft2font.cpp:2207: warning: deprecated conversion from string constant to ‘char*’
src/ft2font.cpp:2207: warning: deprecated conversion from string constant to ‘char*’
error: command 'gcc-4.2' failed with exit status 1
make: *** [binaries] Error 1

@fonnesbeck
Copy link
Author

I've tried this witch clang, but it also chokes on ft2font:

clang -DNDEBUG -g -fwrapv -Os -Wall -I/Users/fonnescj/Code/include -I/Users/fonnescj/Code/include/freetype2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -pipe -arch x86_64 -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/Library/Python/2.7/site-packages/numpy-1.9.0.dev_4b4796a-py2.7-macosx-10.9-intel.egg/numpy/core/include -I/usr/local/Cellar/freetype/2.5.2/include/freetype2 -I/usr/local/include -I/usr/include -I/usr/X11/include -I. -Iextern -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/ft2font.cpp -o build/temp.macosx-10.9-intel-2.7/src/ft2font.o
In file included from src/ft2font.cpp:7:
In file included from src/file_compat.h:4:
In file included from /Library/Python/2.7/site-packages/numpy-1.9.0.dev_4b4796a-py2.7-macosx-10.9-intel.egg/numpy/core/include/numpy/npy_3kcompat.h:23:
In file included from /Library/Python/2.7/site-packages/numpy-1.9.0.dev_4b4796a-py2.7-macosx-10.9-intel.egg/numpy/core/include/numpy/ndarrayobject.h:17:
In file included from /Library/Python/2.7/site-packages/numpy-1.9.0.dev_4b4796a-py2.7-macosx-10.9-intel.egg/numpy/core/include/numpy/ndarraytypes.h:1760:
/Library/Python/2.7/site-packages/numpy-1.9.0.dev_4b4796a-py2.7-macosx-10.9-intel.egg/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: 
      "Using deprecated NumPy API, disable it by "          "#defining
      NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it by " \
 ^
In file included from src/ft2font.cpp:7:
In file included from src/file_compat.h:4:
/Library/Python/2.7/site-packages/numpy-1.9.0.dev_4b4796a-py2.7-macosx-10.9-intel.egg/numpy/core/include/numpy/npy_3kcompat.h:286:40: warning: 
      conversion from string literal to 'char *' is deprecated
      [-Wdeprecated-writable-strings]
    return PyObject_CallFunction(open, "Os", filename, mode);
                                       ^
/Library/Python/2.7/site-packages/numpy-1.9.0.dev_4b4796a-py2.7-macosx-10.9-intel.egg/numpy/core/include/numpy/npy_3kcompat.h:294:37: warning: 
      conversion from string literal to 'char *' is deprecated
      [-Wdeprecated-writable-strings]
    ret = PyObject_CallMethod(file, "close", NULL);
                                    ^
src/ft2font.cpp:191:46: error: too few arguments provided to function-like macro
      invocation
    fh = npy_PyFile_Dup(py_file, (char *)"wb");
                                             ^
/Library/Python/2.7/site-packages/numpy-1.9.0.dev_4b4796a-py2.7-macosx-10.9-intel.egg/numpy/core/include/numpy/npy_3kcompat.h:272:9: note: 
      macro 'npy_PyFile_Dup' defined here
#define npy_PyFile_Dup(file, mode, orig_pos_p) PyFile_AsFile(file)
        ^
src/ft2font.cpp:191:10: error: use of undeclared identifier 'npy_PyFile_Dup'
    fh = npy_PyFile_Dup(py_file, (char *)"wb");
         ^
src/ft2font.cpp:195:36: error: too few arguments provided to function-like macro
      invocation
    npy_PyFile_DupClose(py_file, fh);
                                   ^
/Library/Python/2.7/site-packages/numpy-1.9.0.dev_4b4796a-py2.7-macosx-10.9-intel.egg/numpy/core/include/numpy/npy_3kcompat.h:273:9: note: 
      macro 'npy_PyFile_DupClose' defined here
#define npy_PyFile_DupClose(file, handle, orig_pos) (0)
        ^
src/ft2font.cpp:195:5: error: use of undeclared identifier 'npy_PyFile_DupClose'
    npy_PyFile_DupClose(py_file, fh);
    ^
src/ft2font.cpp:2144:46: error: too few arguments provided to function-like
      macro invocation
    npy_PyFile_DupClose(def->py_file, def->fp);
                                             ^
/Library/Python/2.7/site-packages/numpy-1.9.0.dev_4b4796a-py2.7-macosx-10.9-intel.egg/numpy/core/include/numpy/npy_3kcompat.h:273:9: note: 
      macro 'npy_PyFile_DupClose' defined here
#define npy_PyFile_DupClose(file, handle, orig_pos) (0)
        ^
src/ft2font.cpp:2144:5: error: use of undeclared identifier
      'npy_PyFile_DupClose'
    npy_PyFile_DupClose(def->py_file, def->fp);
    ^
src/ft2font.cpp:2181:51: error: too few arguments provided to function-like
      macro invocation
    if ((fp = npy_PyFile_Dup(py_file, (char *)"rb"))) {
                                                  ^
/Library/Python/2.7/site-packages/numpy-1.9.0.dev_4b4796a-py2.7-macosx-10.9-intel.egg/numpy/core/include/numpy/npy_3kcompat.h:272:9: note: 
      macro 'npy_PyFile_Dup' defined here
#define npy_PyFile_Dup(file, mode, orig_pos_p) PyFile_AsFile(file)
        ^
src/ft2font.cpp:2181:15: error: use of undeclared identifier 'npy_PyFile_Dup'
    if ((fp = npy_PyFile_Dup(py_file, (char *)"rb"))) {
              ^
src/ft2font.cpp:2207:54: warning: conversion from string literal to 'char *' is
      deprecated [-Wdeprecated-writable-strings]
            (data = PyObject_CallMethod(py_file_arg, "read", ""))) {
                                                     ^
src/ft2font.cpp:2207:62: warning: conversion from string literal to 'char *' is
      deprecated [-Wdeprecated-writable-strings]
            (data = PyObject_CallMethod(py_file_arg, "read", ""))) {
                                                             ^
5 warnings and 8 errors generated.
error: command 'clang' failed with exit status 1

@mdboom
Copy link
Member

mdboom commented Jan 13, 2014

It looks like Numpy has changed the C API on us without warning. I'll look into this and see what workaround can be made, or it might require a bug report to Numpy.

@mdboom
Copy link
Member

mdboom commented Jan 13, 2014

I have a fix attached. I've just decided to not rely on Numpy's file API, as I don't think they consider it public and stable -- I've just copied it into the matplotlib tree (it was already there in case we were on a Numpy that was too old).

@pelson
Copy link
Member

pelson commented Jan 14, 2014

@fonnesbeck - any chance you could check this - I'm 👍 for merging if that goes well.

@fonnesbeck
Copy link
Author

Works like a champ. Thanks!

@tacaswell
Copy link
Member

The travis failures are unrelated.

@pelson
Copy link
Member

pelson commented Jan 14, 2014

@mdboom - happy for me to merge? I'm 👍

mdboom added a commit that referenced this pull request Jan 14, 2014
Build fails on OS X with NumPy 1.9
@mdboom mdboom merged commit e6f8993 into matplotlib:master Jan 14, 2014
@charris
Copy link

charris commented Jan 16, 2014

Fixes have gone into numpy in the last couple of days, the problem you encountered cropped up in the process. The fixes were for a longstanding, but unnoticed, bug, so you might want to check them out. The process started with numpy/numpy#4152 and was followed by two more merges.

@mdboom
Copy link
Member

mdboom commented Jan 16, 2014

Yeah -- on further inspection, it was pretty clear that the API change was required in order to fix a bug, which is why I didn't report an issue with Numpy.

The fix here for matplotlib was to just not rely on a semi-private API in Numpy anymore, so that changes over there won't affect us any longer.

@tacaswell
Copy link
Member

@mdboom This needs to be cherry picked to 1.3.x

mdboom added a commit that referenced this pull request Jan 24, 2014
Build fails on OS X with NumPy 1.9
Conflicts:
	src/file_compat.h
	src/ft2font.cpp
@mdboom
Copy link
Member

mdboom commented Jan 24, 2014

Cherry picked as 1ebe784

@mdboom mdboom deleted the fix-numpy-1.9 branch August 7, 2014 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants