[Matplotlib-devel] fail to build matplotlib on smartos(like open solaris) system

Frank Yu flyxiaoyu at gmail.com
Thu Jun 23 00:47:54 EDT 2016


Hi,

I have install matplotlib after a small tweak. but when I try to run test,
I met core dumped.

# pip list|grep matplotlib

matplotlib (2.0.0b1+1704.gf8ea2c5.dirty)

# python tests.py

/opt/local/lib/python2.7/site-packages/matplotlib-2.0.0b1+1704.gf8ea2c5.dirty-py2.7-solaris-2.11-i86pc.64bit.egg/matplotlib/__init__.py:1563:
UserWarning: matplotlib is not built with the correct FreeType version to
run tests.  Set local_freetype=True in setup.cfg and rebuild. Expect many
image comparison failures below.

  "matplotlib is not built with the correct FreeType version to run "

......KKKKKK.KK....Abort (core dumped)

What I did is:

# git diff

diff --git a/src/mplutils.h b/src/mplutils.h

index 8d4ae70..0cc9644 100644

--- a/src/mplutils.h

+++ b/src/mplutils.h

@@ -18,6 +18,12 @@ typedef unsigned __int8   uint8_t;

 #    undef _XOPEN_SOURCE

 #endif



+#if defined(__sun) || defined(sun)

+#if defined(_XPG4)

+#undef _XPG4

+#endif

+#endif

+

 #include <Python.h>



 #if PY_MAJOR_VERSION >= 3

diff --git a/src/numpy_cpp.h b/src/numpy_cpp.h

index 887ffe4..af18b5c 100644

--- a/src/numpy_cpp.h

+++ b/src/numpy_cpp.h

@@ -25,6 +25,12 @@

 #    undef _XOPEN_SOURCE

 #endif



+#if defined(__sun) || defined(sun)

+#if defined(_XPG4)

+#undef _XPG4

+#endif

+#endif

+

 #include <Python.h>

 #include <numpy/ndarrayobject.h>



2016-06-23 11:07 GMT+08:00 Frank Yu <flyxiaoyu at gmail.com>:

> Hi Thomas,
>
> Sorry for ask again, and yes, I can build c program which include
> 'Python.h'.
> I close the issues 6528 because I install it from
> https://pkgsrc.joyent.com/packages/SmartOS/2015Q2/x86_64/All/py27-matplotlib-1.3.1nb1.tgz.
> but it doesn't work well.  So I try to build from source to see what
> happened.
>
>
> 2016-06-23 10:51 GMT+08:00 Thomas Caswell <tcaswell at gmail.com>:
>
>> xref: https://github.com/matplotlib/matplotlib/issues/6528  which has a
>> more readable version of the error.
>>
>> The question I asked in the other thread still stands, can you build
>> _any_ c program that includes `Python.h`?
>>
>> Tom
>>
>> On Wed, Jun 22, 2016 at 10:43 PM Frank Yu <flyxiaoyu at gmail.com> wrote:
>>
>>> Hi there,
>>>
>>> I am trying build matplotlib on smartos(like open solaris) system. but
>>> failed with error. I am build the latest matplotlib. steps as below:
>>>
>>>
>>> # git describe
>>>
>>> v2.0.0b1-1699-g4b3350d
>>>
>>> # python setup.py install
>>>
>>>
>>> ============================================================================
>>>
>>> Edit setup.cfg to change the build options
>>>
>>>
>>> BUILDING MATPLOTLIB
>>>
>>>             matplotlib: yes [2.0.0b1+1699.g4b3350d]
>>>
>>>                 python: yes [2.7.11 (default, Jan 11 2016, 23:16:55)
>>> [GCC
>>>
>>>                         4.9.3]]
>>>
>>>               platform: yes [sunos5]
>>>
>>>
>>> REQUIRED DEPENDENCIES AND EXTENSIONS
>>>
>>>                  numpy: yes [version 1.11.0]
>>>
>>>                    six: yes [The installed version of six is 1.9.0 but a
>>> the
>>>
>>>                         minimum required version is 1.10. pip/easy
>>> install
>>>
>>>                         will attempt to install a newer version.]
>>>
>>>               dateutil: yes [using dateutil version 2.4.0]
>>>
>>>            functools32: yes [using functools32]
>>>
>>>                   pytz: yes [using pytz version 2014.10]
>>>
>>>                 cycler: yes [using cycler version 0.10.0]
>>>
>>>                tornado: yes [using tornado version 4.3]
>>>
>>>              pyparsing: yes [using pyparsing version 2.0.2]
>>>
>>>                 libagg: yes [pkg-config information for 'libagg' could
>>> not
>>>
>>>                         be found. Using local copy.]
>>>
>>>               freetype: yes [version 2.5.5]
>>>
>>>                    png: yes [version 1.6.17]
>>>
>>>                  qhull: yes [pkg-config information for 'qhull' could
>>> not be
>>>
>>>                         found. Using local copy.]
>>>
>>>
>>> OPTIONAL SUBPACKAGES
>>>
>>>            sample_data: yes [installing]
>>>
>>>               toolkits: yes [installing]
>>>
>>>                  tests: yes [using nose version 1.3.7 / mock is required
>>> to
>>>
>>>                         run the matplotlib test suite. Please install it
>>>
>>>                         with pip or your preferred tool to run the test
>>>
>>>                         suite]
>>>
>>>         toolkits_tests: yes [using nose version 1.3.7 / mock is required
>>> to
>>>
>>>                         run the matplotlib test suite. Please install it
>>>
>>>                         with pip or your preferred tool to run the test
>>>
>>>                         suite]
>>>
>>>
>>> OPTIONAL BACKEND EXTENSIONS
>>>
>>>                 macosx: no  [Mac OS-X only]
>>>
>>>                 qt5agg: no  [PySide2 not found; PyQt5 not found]
>>>
>>>                 qt4agg: no  [PySide not found; PyQt4 not found]
>>>
>>>                gtk3agg: no  [Requires pygobject to be installed.]
>>>
>>>              gtk3cairo: no  [Requires pygobject to be installed.]
>>>
>>>                 gtkagg: no  [Requires pygtk]
>>>
>>>                  tkagg: yes [installing; run-time loading from Python
>>> Tcl /
>>>
>>>                         Tk]
>>>
>>>                  wxagg: no  [requires wxPython]
>>>
>>>                    gtk: no  [Requires pygtk]
>>>
>>>                    agg: yes [installing]
>>>
>>>                  cairo: yes [installing, pycairo version 1.10.0]
>>>
>>>              windowing: no  [Microsoft Windows only]
>>>
>>>
>>> OPTIONAL LATEX DEPENDENCIES
>>>
>>>                 dvipng: no
>>>
>>>            ghostscript: no
>>>
>>>                  latex: no
>>>
>>>                pdftops: no
>>>
>>>
>>> OPTIONAL PACKAGE DATA
>>>
>>>                   dlls: no  [skipping due to configuration]
>>>
>>>
>>> running install
>>>
>>> running bdist_egg
>>>
>>> running egg_info
>>>
>>> creating lib/matplotlib.egg-info
>>>
>>> writing requirements to lib/matplotlib.egg-info/requires.txt
>>>
>>> writing lib/matplotlib.egg-info/PKG-INFO
>>>
>>> writing namespace_packages to
>>> lib/matplotlib.egg-info/namespace_packages.txt
>>>
>>> writing top-level names to lib/matplotlib.egg-info/top_level.txt
>>>
>>> writing dependency_links to lib/matplotlib.egg-info/dependency_links.txt
>>>
>>> writing manifest file 'lib/matplotlib.egg-info/SOURCES.txt'
>>>
>>> reading manifest file 'lib/matplotlib.egg-info/SOURCES.txt'
>>>
>>> reading manifest template 'MANIFEST.in'
>>>
>>> writing manifest file 'lib/matplotlib.egg-info/SOURCES.txt'
>>>
>>> installing library code to build/bdist.solaris-2.11-i86pc.64bit/egg
>>>
>>> running install_lib
>>>
>>> running build_py
>>>
>>> creating build
>>>
>>> creating build/lib.solaris-2.11-i86pc.64bit-2.7
>>>
>>> copying lib/pylab.py -> build/lib.solaris-2.11-i86pc.64bit-2.7
>>>
>>> creating build/lib.solaris-2.11-i86pc.64bit-2.7/matplotlib
>>>
>>> copying lib/matplotlib/_version.py ->
>>> build/lib.solaris-2.11-i86pc.64bit-2.7/matplotlib
>>> ​............
>>>
>>> ​running build_ext
>>>
>>> building 'matplotlib.ft2font' extension
>>>
>>> creating build/temp.solaris-2.11-i86pc.64bit-2.7
>>>
>>> creating build/temp.solaris-2.11-i86pc.64bit-2.7/src
>>>
>>> gcc -fno-strict-aliasing -O2 -pipe -O2 -gdwarf-2 -DHAVE_DB_185_H
>>> -pthread -I/usr/include -I/opt/local/include -I/opt/local/include/db4
>>> -I/opt/local/include/ncurses -DNDEBUG -O2 -pipe -O2 -gdwarf-2
>>> -DHAVE_DB_185_H -pthread -I/usr/include -I/opt/local/include
>>> -I/opt/local/include/db4 -I/opt/local/include/ncurses -fPIC
>>> -DFREETYPE_BUILD_TYPE=system
>>> -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API
>>> -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
>>> -I/opt/local/lib/python2.7/site-packages/numpy/core/include
>>> -I/opt/local/include/libpng16 -I/opt/local/include
>>> -I/opt/local/include/freetype2 -I/usr/local/include -I.
>>> -I/opt/local/include/python2.7 -c src/ft2font.cpp -o
>>> build/temp.solaris-2.11-i86pc.64bit-2.7/src/ft2font.o
>>>
>>> gcc -fno-strict-aliasing -O2 -pipe -O2 -gdwarf-2 -DHAVE_DB_185_H
>>> -pthread -I/usr/include -I/opt/local/include -I/opt/local/include/db4
>>> -I/opt/local/include/ncurses -DNDEBUG -O2 -pipe -O2 -gdwarf-2
>>> -DHAVE_DB_185_H -pthread -I/usr/include -I/opt/local/include
>>> -I/opt/local/include/db4 -I/opt/local/include/ncurses -fPIC
>>> -DFREETYPE_BUILD_TYPE=system
>>> -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API
>>> -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION
>>> -I/opt/local/lib/python2.7/site-packages/numpy/core/include
>>> -I/opt/local/include/libpng16 -I/opt/local/include
>>> -I/opt/local/include/freetype2 -I/usr/local/include -I.
>>> -I/opt/local/include/python2.7 -c src/ft2font_wrapper.cpp -o
>>> build/temp.solaris-2.11-i86pc.64bit-2.7/src/ft2font_wrapper.o
>>>
>>> In file included from /opt/local/include/python2.7/Python.h:44:0,
>>>
>>>                  from src/mplutils.h:21,
>>>
>>>                  from src/ft2font_wrapper.cpp:1:
>>>
>>> /usr/include/unistd.h:521:75: error: declaration of C function 'void
>>> swab(const void*, void*, ssize_t)' conflicts with
>>>
>>> In file included from /opt/local/include/python2.7/Python.h:42:0,
>>>
>>>                  from src/mplutils.h:21,
>>>
>>>                  from src/ft2font_wrapper.cpp:1:
>>>
>>> /usr/include/stdlib.h:170:13: error: previous declaration 'void
>>> swab(const char*, char*, ssize_t)' here
>>>
>>> error: command 'gcc' failed with exit status 1
>>>
>>> ​The error is clear, swab was declared twice in both unistd.h and
>>> stdlib.h
>>>
>>> # sed -n 519,522p /usr/include/unistd.h
>>>
>>> #if defined(_XPG4)
>>>
>>> /* __EXTENSIONS__ makes the SVID Third Edition prototype in stdlib.h
>>> visible */
>>>
>>> extern void swab(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD,
>>> ssize_t);
>>>
>>> #endif /* defined(_XPG4) */
>>>
>>> # sed -n 170p /usr/include/stdlib.h
>>> extern void swab(const char *, char *, ssize_t);​
>>>
>>>
>>> # sed -n 158,171p /usr/include/stdlib.h
>>>
>>> #if (defined(__EXTENSIONS__) || \
>>>
>>> (!defined(_STRICT_STDC__) && !defined(_POSIX_C_SOURCE))) && \
>>>
>>> (!defined(_XOPEN_SOURCE) || (defined(_XPG3) && !defined(_XPG4)))
>>>
>>> #ifndef _SSIZE_T
>>>
>>> #define _SSIZE_T
>>>
>>> #if defined(_LP64) || defined(_I32LPx)
>>>
>>> typedef long ssize_t; /* size of something in bytes or -1 */
>>>
>>> #else
>>>
>>> typedef int ssize_t; /* (historical version) */
>>>
>>> #endif
>>>
>>> #endif /* !_SSIZE_T */
>>>
>>>
>>> extern void swab(const char *, char *, ssize_t);
>>>
>>> #endif /* defined(__EXTENSIONS__) || !defined(_STRICT_STDC) ... */
>>>
>>>
>>> ​I saw someone has asked this question, but can't get a proper answer.
>>>
>>>>>>
>>> --
>>> Regards
>>> Frank Yu
>>> _______________________________________________
>>> Matplotlib-devel mailing list
>>> Matplotlib-devel at python.org
>>> https://mail.python.org/mailman/listinfo/matplotlib-devel
>>>
>>
>
>
> --
> Regards
> Frank Yu
>



-- 
Regards
Frank Yu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20160623/ee93891c/attachment-0001.html>


More information about the Matplotlib-devel mailing list