Skip to content

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

Closed

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

Activity

  1. changed the title [-]Matplotlib generates invalid ft2font if -fno-lto gcc CFLAGS[/-] [+]Matplotlib generates invalid ft2font if -fno-lto gcc CFLAGS used[/+] on Jan 3, 2021
  2. QuLogic commented on Jan 4, 2021

    @QuLogic
    Member

    If you want to disable LTO, you should set enable_lto = False in setup.cfg.

  3. added this to the v3.3.4 milestone on Jan 4, 2021
  4. jklymak commented on Jan 5, 2021

    @jklymak
    Member

    @eeyrjmr Any chance you can check that the new setup.py in #19238 works for you?

  5. QuLogic commented on Jan 13, 2021

    @QuLogic
    Member

    This was 1st spotted with matplotlib-3.3.0 and did not occur again with later versions until 3.3.3

    I can't confirm that it ever worked between 3.3.0 and 3.3.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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