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

Issue building on OSX 10.8.2 #1738

Closed
jrdmcgr opened this issue Feb 6, 2013 · 7 comments
Closed

Issue building on OSX 10.8.2 #1738

jrdmcgr opened this issue Feb 6, 2013 · 7 comments

Comments

@jrdmcgr
Copy link

jrdmcgr commented Feb 6, 2013

I'm on OS X 10.8.2

$ git clone https://github.com/matplotlib/matplotlib.git
...
$ cd matplotlib
$ python setup.py build
...
/usr/bin/gcc-4.2 -fno-strict-aliasing -Os -w -pipe -march=core2 -msse4.1 -fwrapv -DNDEBUG -g -fwrapv -O3 -Wall -DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/usr/local/include -I/usr/include -I/usr/X11/include -I/opt/local/include -I/usr/local/lib/python2.7/site-packages/numpy/core/include -I/usr/local/Cellar/freetype/2.4.10/include/freetype2 -I/usr/local/Cellar/freetype/2.4.10/include -I/usr/local/include -I/usr/include -I/usr/X11/include -I. -I/usr/local/Cellar/python/2.7.3/include/python2.7 -c src/ft2font.cpp -o build/temp.macosx-10.4-x86_64-2.7/src/ft2font.o
src/ft2font.cpp: In instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’:
src/ft2font.cpp:854:   instantiated from here
src/ft2font.cpp:854: error: explicit instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’ but no definition available
src/ft2font.cpp: In instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’:
src/ft2font.cpp:854:   instantiated from here
src/ft2font.cpp:854: error: explicit instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’ but no definition available
src/ft2font.cpp: In instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’:
src/ft2font.cpp:854:   instantiated from here
src/ft2font.cpp:854: error: explicit instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’ but no definition available
src/ft2font.cpp: In instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’:
src/ft2font.cpp:854:   instantiated from here
src/ft2font.cpp:854: error: explicit instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’ but no definition available
src/ft2font.cpp: In instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’:
src/ft2font.cpp:854:   instantiated from here
src/ft2font.cpp:854: error: explicit instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’ but no definition available
error: command '/usr/bin/gcc-4.2' failed with exit status 1

It seems like I am missing some headers or some other code, but I'm just guessing. Any help would be appreciated.

@pelson
Copy link
Member

pelson commented Feb 6, 2013

I'm able to build on 10.8.2 without a hitch.
Can you provide the the printed header generated when running setup.py. My system produces:

============================================================================
BUILDING MATPLOTLIB
            matplotlib: 1.2.0
                python: 2.7.3 (default, Sep 25 2012, 07:42:24)  [GCC 4.2.1
                        Compatible Apple Clang 4.1
                        ((tags/Apple/clang-421.11.65))]
              platform: darwin

REQUIRED DEPENDENCIES
                 numpy: 1.6.2
             freetype2: 15.0.9

OPTIONAL BACKEND DEPENDENCIES
                libpng: 1.5.12
               Tkinter: Tkinter: 81008, Tk: 8.5, Tcl: 8.5
                  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
                PySide: no
                 Cairo: no

OPTIONAL DATE/TIMEZONE DEPENDENCIES
              dateutil: 1.5
                  pytz: 2011c

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

@jrdmcgr
Copy link
Author

jrdmcgr commented Feb 7, 2013

============================================================================
BUILDING MATPLOTLIB
            matplotlib: 1.3.x
                python: 2.7.3 (default, Apr 26 2012, 21:11:05)  [GCC 4.2.1
                        (Apple Inc. build 5664)]
              platform: darwin

REQUIRED DEPENDENCIES
                 numpy: 1.6.2
             freetype2: 15.0.9

OPTIONAL BACKEND DEPENDENCIES
                libpng: 1.5.13
               Tkinter: Tkinter: 81008, Tk: 8.5, Tcl: 8.5
                  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
                PySide: no
                 Cairo: no
      Tornado (webagg): no

OPTIONAL DATE/TIMEZONE DEPENDENCIES
              dateutil: 1.5
                  pytz: 2012j

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

Maybe it's matplotlib 1.2.0 vs 1.3.x?

@tacaswell
Copy link
Member

@jrdmcgr If this is still an issue please re-open

@valo
Copy link

valo commented Mar 9, 2014

I am having the same problem on OSX 10.9.1:

    BUILDING MATPLOTLIB
                matplotlib: yes [1.3.1]
                    python: yes [2.7 (r27:82500, Feb 21 2014, 18:09:04)  [GCC
                            4.2.1 (Apple Inc. build 5666) (dot 3)]]
                  platform: yes [darwin]
    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [version 1.6.2]
                  dateutil: yes [using dateutil version 2.2]
                   tornado: yes [tornado was not found. It is required for the
                            WebAgg backend. pip/easy_install may attempt to
                            install it after matplotlib.]
                 pyparsing: yes [pyparsing was not found. It is required for
                            mathtext support. pip/easy_install may attempt to
                            install it after matplotlib.]
                     pycxx: yes [Couldn't import.  Using local copy.]
                    libagg: yes [pkg-config information for 'libagg' could not
                            be found. Using local copy.]
                  freetype: yes [version 17.1.11]
                       png: yes [version 1.5.18]
    OPTIONAL SUBPACKAGES
               sample_data: yes [installing]
                  toolkits: yes [installing]
                     tests: yes [nose 0.11.1 or later is required to run the
                            matplotlib test suite]
    OPTIONAL BACKEND EXTENSIONS
                    macosx: yes [installing, darwin]
                    qt4agg: no  [PyQt4 not found]
                   gtk3agg: no  [Requires pygobject to be installed.]
                 gtk3cairo: no  [Requires cairo to be installed.]
                    gtkagg: no  [Requires pygtk]
                     tkagg: yes [installing, version 81008]
                     wxagg: no  [requires wxPython]
                       gtk: no  [Requires pygtk]
                       agg: yes [installing]
                     cairo: no  [cairo not found]
                 windowing: no  [Microsoft Windows only]
    OPTIONAL LATEX DEPENDENCIES
                    dvipng: no
               ghostscript: no
                     latex: no
                   pdftops: no

and the error:

    building 'matplotlib.ft2font' extension
    /usr/local/bin//gcc-4.2 -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/Users/valentin/.pyenv/versions/2.7/lib/python2.7/site-packages/numpy/core/include -I/usr/local/include -I/usr/include -I/usr/X11/include -I. -I/usr/local/Cellar/freetype/2.5.2/include/freetype2 -I/Users/valentin/.pyenv/versions/2.7/include/python2.7 -c src/ft2font.cpp -o build/temp.macosx-10.4-x86_64-2.7/src/ft2font.o
    src/ft2font.cpp: In instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits, _Alloc = std::allocator]’:
    src/ft2font.cpp:854:   instantiated from here
    src/ft2font.cpp:854: error: explicit instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits, _Alloc = std::allocator]’ but no definition available
    src/ft2font.cpp: In instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits, _Alloc = std::allocator]’:
    src/ft2font.cpp:854:   instantiated from here
    src/ft2font.cpp:854: error: explicit instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits, _Alloc = std::allocator]’ but no definition available
    src/ft2font.cpp: In instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits, _Alloc = std::allocator]’:
    src/ft2font.cpp:854:   instantiated from here
    src/ft2font.cpp:854: error: explicit instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits, _Alloc = std::allocator]’ but no definition available
    src/ft2font.cpp: In instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits, _Alloc = std::allocator]’:
    src/ft2font.cpp:854:   instantiated from here
    src/ft2font.cpp:854: error: explicit instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits, _Alloc = std::allocator]’ but no definition available
    src/ft2font.cpp: In instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits, _Alloc = std::allocator]’:
    src/ft2font.cpp:854:   instantiated from here
    src/ft2font.cpp:854: error: explicit instantiation of ‘std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits, _Alloc = std::allocator]’ but no definition available
    error: command '/usr/local/bin//gcc-4.2' failed with exit status 1
    Complete output from command /Users/valentin/.pyenv/versions/2.7/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/h_/jrvb3jpj6wl67l8jk14v7s6w0000gp/T/pip_build_valentin/matplotlib/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/h_/jrvb3jpj6wl67l8jk14v7s6w0000gp/T/pip-ecPPeW-record/install-record.txt --single-version-externally-managed --compile:

I installed the freetype and libpng libs with homebrew. I am also using pyenv to manage my local python versions.

@valo
Copy link

valo commented Mar 9, 2014

Building against the OSX system python was successful, so the problem is only there when building against a pyenv installed python.

I fixed the issue in the above case by adding a compiler option: -mmacosx-version-min=10.9

The code is something like this in setupext.py, class CXX, add_flags:

        # OSX 10.9 requires a special flag
        if sys.platform == "darwin" and re.match("10\.9.*$", platform.mac_ver()[0]):
            ext.extra_compile_args.append("-mmacosx-version-min=10.9")

I can provide a pull request for this, but I am not sure this is a use case that should be supported by the library, because using a non-system python prevents matplotlib from using the native macosx backend.

Do you want a pull request for this?

@tacaswell
Copy link
Member

I think a PR would be good. Not everyone on mac wants to use the native backend and this seems like a small enough change that it is worth including.

@valo
Copy link

valo commented Mar 10, 2014

Here it is: #2883

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

No branches or pull requests

4 participants