Skip to content

BLD: Simplify library linking on Windows #9693

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

Closed
wants to merge 1 commit into from

Conversation

Kojoley
Copy link
Member

@Kojoley Kojoley commented Nov 5, 2017

The PR simplifies matplotlib build process on Windows (especially with conda).
Implemented a new environment variable and setup.cfg option to switch between static or shared linking (useful for wheels).

I am not sure about the default value of the switch. I think that in conda env by default build should be shared and at wheels building it should be static. I did not touch freetype because on Windows shared freetype is not supported.

P.S: zlib in default freetype libs seems to me as not a right guess. It could require any of zlib, bzip2, libpng, harfbuzz for linking (depends on used flags at freetype building).

@Kojoley Kojoley added this to the v2.2 milestone Nov 5, 2017
INSTALL.rst Outdated
# Make the header files and the rest of the static libs available during the build
# CONDA_DEFAULT_ENV is a env variable which is set to the currently active environment path
set MPLBASEDIRLIST=%CONDA_DEFAULT_ENV%\Library\;.
# to force the build against static libpng and zlib libraries do follow
Copy link
Contributor

Choose a reason for hiding this comment

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

do follow = typo?

Copy link
Member Author

Choose a reason for hiding this comment

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

My bad English. I meant do the following.

@Kojoley Kojoley force-pushed the bld-improve-win-linking branch from d3cbc1f to 0a89734 Compare November 19, 2017 19:03
@anntzer
Copy link
Contributor

anntzer commented Nov 19, 2017

On linux, the correct way to link freetype (or other librairies) statically is to pass in the result of pkg-config --static --libs freetype2, which will include whatever libraries are needed based on freetype's compile-time flags (for me, it gives -lfreetype -lbz2 -lpng16 -lm -lz -lm -lz -lharfbuzz -lm -lglib-2.0 -pthread -lpcre -pthread -lgraphite2).
Do you know if there is an equivalent on Windows? Or perhaps static libs already include all other needed libs?

@Kojoley
Copy link
Member Author

Kojoley commented Nov 25, 2017

Do you know if there is an equivalent on Windows?

https://en.wikipedia.org/wiki/Auto-linking

Or perhaps static libs already include all other needed libs?

Not necessarily, it depends how static lib was built.

@Kojoley
Copy link
Member Author

Kojoley commented Nov 25, 2017

@anntzer maybe you know a better way than 'bdist_wheel' in sys.argv to determining a wheel build?

@Kojoley Kojoley force-pushed the bld-improve-win-linking branch from 0a89734 to f650c67 Compare November 25, 2017 18:57
@anntzer
Copy link
Contributor

anntzer commented Nov 25, 2017

I think the "correct" way is to subclass the bdist_wheel command? (if you override a method called early enough it should be sufficient to override the options on the extensions).

@tacaswell
Copy link
Member

This was included in #13077 so closing.

@tacaswell tacaswell closed this Aug 27, 2019
@tacaswell tacaswell removed this from the needs sorting milestone Aug 27, 2019
@Kojoley Kojoley deleted the bld-improve-win-linking branch August 27, 2019 13:18
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.

3 participants