Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

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

Merged
merged 1 commit into from
Oct 10, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ def __init__(self):
self.set_pkgconfig_path()
status, output = getstatusoutput("pkg-config --help")
self.has_pkgconfig = (status == 0)
if not self.has_pkgconfig:
print("IMPORTANT WARNING:")
print(
" pkg-config is not installed.\n"
" matplotlib may not be able to find some of its dependencies")

def set_pkgconfig_path(self):
pkgconfig_path = sysconfig.get_config_var('LIBDIR')
Expand Down Expand Up @@ -981,19 +986,13 @@ def add_flags(self, ext):
pkg_config.setup_extension(
ext, 'freetype2',
default_include_dirs=[
'freetype2', 'lib/freetype2/include',
'include/freetype2', 'freetype2',
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.

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

def get_extension(self):
if sys.platform == 'win32':
return None
ext = make_extension('freetype2', [])
self.add_flags(ext)
return ext


class FT2Font(SetupPackage):
Expand Down