Skip to content

Cross-compiling matplotlib and dependencies for OpenWRT fails on import matplotlib.pyplot #9244

Closed
@jwbrack

Description

@jwbrack

Bug report

Bug summary

When cross-compiling matplotlib and dependencies (numpy, six, pytz, etc) for OpenWRT in Ubuntu 16.04LTS, all code properly compiles. However, when testing matplotlib on the target, when importing matplotlib.pyplot I get the failure "terminate called after throwing an instance of 'char const*'". Specifically, after a font is imported in font_manager, the failure comes up when attempting to add a second font (regardless of the first font). I've attempted multiple versions of Python3 (3.6.2, 3.6.0, 3.5.4), as well as numerous combinations of dependent packages. Not that I am only compiling freetype as a library for the shared object "libfreetype.so.6*", as well as the ft2font header file, instead of the full freetype package.

Code for reproduction

import matplotlib
print(matplotlib.__version__)
import matplotlib.pyplot as plt
print("Success!")

Actual outcome

root@LEDE:~# python3 test.py --verbose-debug
$HOME=/root
matplotlib data path /usr/lib/python3.6/site-packages/matplotlib/mpl-data

*****************************************************************
You have the following UNSUPPORTED LaTeX preamble customizations:

Please do not ask for support with these customizations active.
*****************************************************************

loaded rc file /usr/lib/python3.6/site-packages/matplotlib/mpl-data/matplotlibrc
matplotlib version 2.0.2
verbose.level debug
interactive is False
platform is linux
loaded modules: <dict_keyiterator object at 0x17ebb00>
CACHEDIR=/root/.cache/matplotlib
font search path ['/usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf', '/usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/afm', '/usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts']
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmb10.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmr10.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizOneSymReg.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizThreeSymBol.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Oblique.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-Bold.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneral.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerifDisplay.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniBolIta.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmex10.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmmi10.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmss10.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizTwoSymBol.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmsy10.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmtt10.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUni.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-BoldOblique.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralItalic.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBolIta.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-Bold.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizFiveSymReg.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSans-Oblique.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXGeneralBol.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizThreeSymReg.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizFourSymBol.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizFourSymReg.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniBol.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniIta.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-BoldItalic.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansDisplay.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-Bold.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizTwoSymReg.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/STIXSizOneSymBol.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSansMono-BoldOblique.ttf
trying fontname /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/DejaVuSerif-Italic.ttf
createFontDict: /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmb10.ttf
createFontDict: /usr/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/cmr10.ttf
terminate called after throwing an instance of 'char const*'
Aborted

Expected outcome

root@LEDE:~# python3 test.py 
2.0.2
Success!

Matplotlib version

  • Operating System: OpenWRT / LEDE V17.01.02
  • Matplotlib Version: 2.0.2
  • Python Version: 3.6.2
  • Other Libraries:
    • numpy: 1.12.1
    • six: 1.10.0
    • dateutil: 2.6.1
    • pytz: 2017.2
    • cycler: 0.10.0
    • pyparsing: 2.2.0
    • libfreetype: 2.5.5
    • libpng: 1.2.57
BUILDING MATPLOTLIB
            matplotlib: yes [2.0.2]
                python: yes [3.6.2 (default, Jun  8 2017, 21:02:37)  [GCC
                        5.4.0 20160609]]
              platform: yes [linux]

REQUIRED DEPENDENCIES AND EXTENSIONS
                 numpy: yes [version 1.12.1]
                   six: yes [using six version 1.10.0]
              dateutil: yes [using dateutil version 2.6.1]
           functools32: yes [Not required]
          subprocess32: yes [Not required]
                  pytz: yes [using pytz version 2017.2]
                cycler: yes [using cycler version 0.10.0]
               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 [using pyparsing version 2.2.0]
                libagg: yes [pkg-config information for 'libagg' could not
                        be found. Using local copy.]
              freetype: yes [version 2.5.5]
                   png: yes [version 1.2.57]
                 qhull: yes [pkg-config information for 'qhull' could not be
                        found. Using local copy.]

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: inactiveMarked by the “Stale” Github Action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions