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

fix pkg-config handling to make cross-compiling work #11218

Closed
wants to merge 2 commits into from
Closed

fix pkg-config handling to make cross-compiling work #11218

wants to merge 2 commits into from

Conversation

vapier
Copy link

@vapier vapier commented May 10, 2018

This series cleans up the pkg-config logic so that cross-compile works properly. There's still some weirdness with the use of freetype-config/libpng-config, but I've ignored that as it only impacts the display and not the actual config/code generation.

@vapier
Copy link
Author

vapier commented May 10, 2018

hopefully travis can provide test coverage here as i couldn't get pytest to pass on master (even w/out my changes). i was able to validate basic build+install via pip though.

@jklymak jklymak added the Build label May 10, 2018
@jklymak jklymak added this to the v3.0 milestone May 10, 2018
@jklymak
Copy link
Member

jklymak commented May 10, 2018

Thanks for re-opening! Sorry about the original closure. Please do ping if no one reviews in a week or so...

@jklymak
Copy link
Member

jklymak commented May 28, 2018

Can someone who understand the build process better than me take a look at this?

self.has_pkgconfig = shutil.which(self.pkg_config) is not None
if not self.has_pkgconfig:
print("IMPORTANT WARNING:\n"
" pkg-config is not installed.\n"
" matplotlib may not be able to find some of its dependencies")

def set_pkgconfig_path(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was this removed?
Note that (unchecked...) this may be needed to make things work in a conda env which does install the libraries in the environment but where pkg-config is "outside" the env (because sysconfig.get_config_var("LIBDIR") will correctly point inside the env in that case).

Copy link
Author

Choose a reason for hiding this comment

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

i explained in the commit message. did you see that ?

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, but in that case I would like someone (perhaps me, just not now) to check whether building Matplotlib as follows still works: in a conda env, freetype and libpng installed from conda, pkg-config not installed from conda but available outside of conda (e.g. from the distro). Also, what gets linked (the conda libs or the distro libs) in the shared objects in that case?
I'm not saying this won't work or that this absolutely needs to work, but if it used to and doesn't anymore, then one should make sure that the docs clearly state that a conda pkg-config is needed in that setup.

Copy link
Member

@jklymak jklymak May 29, 2018

Choose a reason for hiding this comment

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

Personally, I usually don't read the commit messages. We usually include important info in the PR body above and/or the code itself. (EDIT:) We usually try and keep the commit messages quite minimal. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

(I don't think that "trying to keep commit messages minimal" is a good advice (quite the contrary...). But yes, it's good to also good to duplicate all the info in the thread.)

Copy link
Author

Choose a reason for hiding this comment

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

sorry, but i'm not familiar with conda (assuming you're referring to https://conda.io/), so i really have no idea how to test it

the goal here isn't to make pkg-config required, but to make it so that if the package supports pkg-config, we only use that info

Copy link
Member

Choose a reason for hiding this comment

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

Please put details in the commit messages! Those are what help you in 5 years while checking git blame 😉

@tacaswell
Copy link
Member

I agree than making sure this does not break building in virtual environments (either venv or conda) is critical.

Is there a way to identify things are being cross complied and bail in only that case?

This needs a re-base onto current master.

The current code always sets PKG_CONFIG_PATH to build paths in / which
breaks cross-compiling -- things like /usr/lib are for the build system
(e.g. x86) and not for the target (e.g. arm).  Since we're adding paths
that are already the default for pkg-config, there's no point in trying
to be smart here.  Just punt the code.

This basically reverts commit 101beb9.
…able

If we have pkg-config, then there's no need to hardcode the system -I/-L
paths as the pkg-config files will give us all the info we need.
@anntzer
Copy link
Contributor

anntzer commented May 29, 2018

Things actually appear to work fine in the setup I described, although it's totally unclear to me why they do (I expected they wouldn't; I guess I don't understand enough about shared object resolution...).

@tacaswell tacaswell modified the milestones: v3.0, v3.1 Jul 9, 2018
@anntzer
Copy link
Contributor

anntzer commented Dec 29, 2018

@vapier Does #13064 help with cross-compilation?

@jklymak
Copy link
Member

jklymak commented Feb 9, 2019

What is the status of this one?

@anntzer
Copy link
Contributor

anntzer commented Feb 9, 2019

I think #13064 will close this.

@jklymak
Copy link
Member

jklymak commented Feb 27, 2019

I'm going to close this as stale and/or obviated by recent changes to the build. OTOH, if it still has good bits in it, please do re-open.

Thanks a lot @vapier for your help with this - it looks like it inspired some changes, even if this PR didn't go through...

@jklymak jklymak closed this Feb 27, 2019
@anntzer
Copy link
Contributor

anntzer commented Feb 27, 2019

Specifically, please reopen and reping if #13064 does not suffice (in which case I would like to know why).
(The issue is still valid at least as long as #13064 is not merged.)

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 this pull request may close these issues.

None yet

4 participants