Skip to content

Matplotlib generates invalid ft2font if -fno-lto gcc CFLAGS used #19227

Closed
@eeyrjmr

Description

@eeyrjmr

Bug report

Bug summary

If matplotlib is build with -fno-lto CFLAGS then the build is completed "successfully" but will fail to import
This was 1st spotted with matplotlib-3.3.0 and did not occur again with later versions until 3.3.3

TEST 1:
CFLAGS="-O2 -pipe -fomit-frame-pointer -march=native"

emerge matplotlib
Calculating dependencies... done!
>>>Verifying ebuild manifests
>>>Emerging (1 of 1) dev-python/matplotlib-3.3.3::gentoo
>>>Installing (1 of 1) dev-python/matplotlib-3.3.3::gentoo
>>> Jobs: 1 of 1 complete                           Load avg: 0.93, 0.65, 0.92
>>>Auto-cleaning packages...
fluidmotion ~ # python
Python 3.8.7 (default, Dec 22 2020, 17:30:32)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>>

BUILD LOG: dev-python:matplotlib-3.3.3:20210103-123758.log


TEST 2:
CFLAGS="-O2 -pipe -fomit-frame-pointer -march=native -fno-lto"

emerge matplotlib
Calculating dependencies... done!
>>> Verifying ebuild manifests
>>> Emerging (1 of 1) dev-python/matplotlib-3.3.3::gentoo
>>> Installing (1 of 1) dev-python/matplotlib-3.3.3::gentoo
>>> Jobs: 1 of 1 complete                           Load avg: 0.73, 0.57, 0.84
>>> Auto-cleaning packages...
fluidmotion /var/log/portage # python
Python 3.8.7 (default, Dec 22 2020, 17:30:32)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.8/site-packages/matplotlib/__init__.py", line 174, in <module>
    _check_versions()
  File "/usr/lib/python3.8/site-packages/matplotlib/__init__.py", line 159, in _check_versions
    from . import ft2font
ImportError: dynamic module does not define module export function (PyInit_ft2font)
>>>

BUILD LOG:dev-python:matplotlib-3.3.3:20210103-124106.log

Difference:
/var/tmp/portage/dev-python/matplotlib-3.3.3/work/matplotlib-3.3.3-python3_8/build/temp.linux-x86_64-3.8/src/checkdep_freetype2.o: plugin needed to handle lto object
/var/tmp/portage/dev-python/matplotlib-3.3.3/work/matplotlib-3.3.3-python3_8/build/temp.linux-x86_64-3.8/src/checkdep_freetype2.o: plugin needed to handle lto object
/var/tmp/portage/dev-python/matplotlib-3.3.3/work/matplotlib-3.3.3-python3_8/build/temp.linux-x86_64-3.8/src/ft2font.o: plugin needed to handle lto object
/var/tmp/portage/dev-python/matplotlib-3.3.3/work/matplotlib-3.3.3-python3_8/build/temp.linux-x86_64-3.8/src/ft2font.o: plugin needed to handle lto object
/var/tmp/portage/dev-python/matplotlib-3.3.3/work/matplotlib-3.3.3-python3_8/build/temp.linux-x86_64-3.8/src/ft2font_wrapper.o: plugin needed to handle lto object
/var/tmp/portage/dev-python/matplotlib-3.3.3/work/matplotlib-3.3.3-python3_8/build/temp.linux-x86_64-3.8/src/ft2font_wrapper.o: plugin needed to handle lto object
/var/tmp/portage/dev-python/matplotlib-3.3.3/work/matplotlib-3.3.3-python3_8/build/temp.linux-x86_64-3.8/src/mplutils.o: plugin needed to handle lto object
/var/tmp/portage/dev-python/matplotlib-3.3.3/work/matplotlib-3.3.3-python3_8/build/temp.linux-x86_64-3.8/src/mplutils.o: plugin needed to handle lto object
/var/tmp/portage/dev-python/matplotlib-3.3.3/work/matplotlib-3.3.3-python3_8/build/temp.linux-x86_64-3.8/src/py_converters.o: plugin needed to handle lto object
/var/tmp/portage/dev-python/matplotlib-3.3.3/work/matplotlib-3.3.3-python3_8/build/temp.linux-x86_64-3.8/src/py_converters.o: plugin needed to handle lto object
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/crtendS.o: plugin needed to handle lto object

RAW build logs can be found here: https://bugs.gentoo.org/736122

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions