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

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

Closed
eeyrjmr opened this issue Jan 3, 2021 · 3 comments · Fixed by #19238
Closed

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

eeyrjmr opened this issue Jan 3, 2021 · 3 comments · Fixed by #19238
Labels
Milestone

Comments

@eeyrjmr
Copy link

eeyrjmr commented Jan 3, 2021

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

@eeyrjmr eeyrjmr changed the title Matplotlib generates invalid ft2font if -fno-lto gcc CFLAGS Matplotlib generates invalid ft2font if -fno-lto gcc CFLAGS used Jan 3, 2021
@QuLogic
Copy link
Member

QuLogic commented Jan 4, 2021

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

@QuLogic QuLogic added this to the v3.3.4 milestone Jan 4, 2021
@QuLogic QuLogic added the Build label Jan 4, 2021
@jklymak
Copy link
Member

jklymak commented Jan 5, 2021

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

@QuLogic
Copy link
Member

QuLogic commented Jan 13, 2021

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
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants