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

setup.py creates a zombie C extension called "freetype2" #3622

Merged
merged 1 commit into from Oct 10, 2014

Conversation

mdboom
Copy link
Member

@mdboom mdboom commented Oct 7, 2014

Since #3067, there has been a useless and unimportable extension created as part of the matplotlib install. We need to remove it.

However, it reportedly fixes a real bug for some, but it's not quite clear how. I'll poke around and see if I can break/fix it in the same way as the original reports and then find a better solution that doesn't install a broken .so file.

>>> import freetype2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dynamic module does not define init function (initfreetype2)

The name of matplotlib's freetype wrapper is ft2font, not freetype2.

@mdboom mdboom added this to the v1.4.1 milestone Oct 7, 2014
@mdboom mdboom self-assigned this Oct 7, 2014
@mdboom
Copy link
Member Author

mdboom commented Oct 7, 2014

So, at least on Fedora, if you have freetype installed, but pkg-config is somehow broken (I had to manually move it), freetype-config reports a completely bogus value for the include path for freetype: -I/freetype2. Using freetype-config if pkg-config isn't installed was something I did in 090effa, and it worked then, but it doesn't seem to work now.

So, as reported in #3029, installing pkg-config does resolve that issue. We can warn when pkg-config isn't installed that things may not work (though continue to "try" anyway).

I'm still not sure how #3067 resolves anything, though. It does get to an error state when the user has no pkg-config, as it doesn't even try to compile anything, but I'm not sure that's a real improvement.

seems to be broken.  Use that only for version determination.  Warn if
pkg-config is not present.
@mdboom
Copy link
Member Author

mdboom commented Oct 7, 2014

Fix attached.

@efiring
Copy link
Member

efiring commented Oct 7, 2014

Your insertion of the warning brings up a thought I have had every time I build mpl: the important section of output at the start of the build, with the information about what was found, scrolls by and is almost immediately lost. Yes, I could use redirection to save it, but I shouldn't have to. Maybe the info could be written to a file, and also displayed again at the end of a build. Otherwise, no one will see your new warning, in most cases.

@WeatherGod
Copy link
Member

@efiring, +1. Always been a pet peeve of mine.

On Tue, Oct 7, 2014 at 6:40 PM, Eric Firing notifications@github.com
wrote:

Your insertion of the warning brings up a thought I have had every time I
build mpl: the important section of output at the start of the build, with
the information about what was found, scrolls by and is almost immediately
lost. Yes, I could use redirection to save it, but I shouldn't have to.
Maybe the info could be written to a file, and also displayed again at the
end of a build. Otherwise, no one will see your new warning, in most cases.


Reply to this email directly or view it on GitHub
#3622 (comment)
.

@tacaswell
Copy link
Member

Sorry for merging broken things.....

@mdboom
Copy link
Member Author

mdboom commented Oct 8, 2014

No worries! Small mistakes are a small price to pay for so much good work and progress.

'lib/freetype2/include/freetype2'],
default_library_dirs=[
'freetype2/lib'],
default_libraries=['freetype', 'z'],
alt_exec='freetype-config')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to get rid of the alt_exec?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's the crux of the fix here. At least on my system, the result from freetype-config --cflags is totally and utterly wrong (-I/freetype2), so better to use pkg-config and, failing that, fall back to the regular default locations. I suspect this was the source of all of the problems that led to the #3067 solution in the first place.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I identified the main fix as adding more guesses to the default path.

tacaswell added a commit that referenced this pull request Oct 10, 2014
BLD : fix finding "freetype2"
@tacaswell tacaswell merged commit d3550c5 into matplotlib:v1.4.x Oct 10, 2014
@mdboom mdboom deleted the freetype-fix branch March 3, 2015 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants