-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
import('python') seperate python binary from libs #11129
Comments
also vcpkg as theoretically 5 python locations: a) the python executing meson I doubt meson is capable of correctly distinguishing these cases. |
What does this mean in practice? How do you build Python extensions with setuptools for such a system? How does a Python interpreter know from where to load libraries if there is no relation between the interpreter and the library locations? You can build extensions modules for a Python different than the one used to execute Meson just fine by using |
That is totally irrelevant for the issue. Meson shouldn't be concerned about those issues. setuptools won't be used. vcpkg is not going to package python stuff it just needs the capability to execute build scripts wanting to also build python extensions.
How? via python = '<path_to_python>' ? Every time I tried that it crashed meson. |
You are not providing enough information to understand where the issue is and whether there is any possibility to support your use case. Vague statements about the environment in which you are trying to build Python extensions and a generic "It does not work" and are not very actionable. Setuptools are the de facto standard solution to build Python extensions. If setuptools works in the vcpkg environment, most likely meson works too or can be made to work.
Can you be more precise about what you tried and how it failed? |
meson/mesonbuild/modules/python.py Line 292 in 8a72558
Did not find python3. I provide have a pkg_config_path setup with the correct python-3.10.pc but it wasn't used/found. meson/mesonbuild/modules/python.py Lines 319 to 322 in 8a72558
It should be always go looking? Removing the if makes the lookup work.... |
I still have no idea of what you are trying to do, how you tried to do it, and how it failed. Would you mind going one step back and provide an example |
building stuff in vcpkg using meson. In more detail: Updating meson from 0.63 to 064.1. The error is e.g.
because meson is not using the pc file provided by vcpkg for python because it never looks for it and just tries to find some system installed libs.... and example for a native file is (for I previously patched it by adding/modifying the meson.build to include:
but that is no longer working since meson automatically pulls in the dependency now for |
It's a python config_var(), many of which (including this one) come from the Unix Makefile used to build python and therefore are not available when building with the Visual Studio solution. Sadly python upstream doesn't distribute a pkg-config file at all in such a situation.
That would essentially say "I know that python itself doesn't provide a pkg-config file, but check if the user hand-wrote one and added it to the default pkg_config_path", which is probably wrong in all situations other than vcpkg but would surely help vcpkg. It's probably usually harmless other than wasted time doing a lookup, but might have odd effects when using meson to build extensions for a python that came directly from python.org and also having e.g. msys2 python in the environment.
I would say it's very relevant, as it indicates more general issues than just Meson.
Sorry, what does this mean? Are you saying you just need meson to successfully configure the project, but you don't actually want to build code relying on meson's If you're trying to build projects that have multiple build artifacts including a python module, maybe the right solution here is to ask those projects to add an option to disable building the python extension component? e.g. |
From the information provided so far and from the observation that Meson correctly works with Python installations of all kinds, except the one provided by vcpkg, I would lean toward saying that vcpkg provides a non functional Python installation. What you linked as a |
No that is not the issue. Python from vcpkg can be used fine.....it works in cmake and i can manually start and use it.....
yeah i never said something different....
Meson should behave sane instead of having unexpected behavior. If I have a pkg-config for python it should just use it instead of being clever and have introspection on how python normally works.... meson needs to support all possible use cases and hand feeding it a valid pkg-config file is one of those.
Yeah you do that, I just fix meson in vcpkg in the meantime. as I said. The issue is fixed if |
Can you please stop trying to convince us that Meson is doing the wrong thing and provide the required information? We are trying to help you and trying to understand how to support your use case but you are making it as hard as it can be. No one with the possibility to fix the alleged bug in Meson seems to be affected by the issue you report, therefore your only way to get the issue resolved is to collaborate. If you think you know better, I'm done loosing my time on this.
I'm pretty sure you cannot build a package using setuptools with it. And this classifies as "broken" for me. |
What extra information do you want? I already gave all relevant information. The python module is not using pkg-config files but instead hardcoding search paths for the python libs on windows. here is the pkg-config file if you need it:
doubt that. My issues will be solved by microsoft/vcpkg#28084 by simply patching meson used by vcpkg as described. vcpkg also fixes broken cmake modules so I just apply the same logic for meson.
Why does meson care about that? Is meson using |
It took a bit of effort but you have provided an example |
distutils, but yes. (A little bit. Not for finding libraries, but yes for checking iff the libraries should be linked to.)
It's somewhat relevant inasmuch as ports that build python bindings for those c/c++ libs would historically tend to use setuptools to do it. |
For a PCBuild version of python, which I assume is what vcpkg uses, Meson will check for the DLL using |
Here let me throw more irrelevant logs at you: (actually need to extract them before uploading to github else they are empty): |
The |
meson/mesonbuild/modules/python.py Lines 220 to 222 in 9e8a3b9
base_prefix/../../(debug/)?lib and that is something meson/python cannot deal with by default. Which is why feeding pkg-config is superior.
Have not yet seen linker errors due to missing symbols. So I assume this isn't generally true. |
Are you saying you want to use a pkg-config file to specify the path where to find a library you are not going to link with? |
I can't find authoritative docs on this, but python/cpython#65735 (comment)
This was also originally discussed in #4117. Window has this documentation too
|
@eli-schwartz: Even if I modify |
Can you check if this is still a problem after commit aa69cf0?
Since the commit I mentioned,
We don't skip checking for pkg-config even on Windows, if you get it via |
Is that commit part of 1.1.0 ? I currently use https://github.com/microsoft/vcpkg/pull/28084/files#diff-252e4529dcfc3d1f5cdda010e195917889e89a0dacc875caa16446add749343e to fix one issue. Had do deactivate the x86 build of gobject-introspection since it tried to build and link x64 libs. ( |
Yes. |
So vcpkg separates the python tool from the python libs as such whatever I try the layout will not be as meson hardcodes/expects it to be and as thus won't be able to find it. I have pkg-config files for python but somehow the python module is not clever enough to use the pkg_config_path setup I fed it but rather wants
LIBPC
to be set (whatever that is; it is not documented and google didn't bring up any useful).So please provide proper injection points for solving these path issue instead of being a now-it-all because apparently that doesn't work.
The current behavior blocks migrating vcpkg from meson 0.63 to 0.64.1 since
extension_module
is unusable due to not being able to find the libs. (vcpkg solved it previously by manually supplyinglibpython_dep=dependency(....)
)The text was updated successfully, but these errors were encountered: