mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.6k stars 1.63k forks source link

python3 extension module cannot find library if meson launched from a virtualenv #3748

Open guruDanny67 opened 6 years ago

guruDanny67 commented 6 years ago

I'm building gobject-introspection (from https://github.com/wingtk/gvsbuild) and everything is ok if I use the main python interpreter.

If I use a virtualenv python I get the message 'Could not find Python3 library python36' and the build abort.

Even if I add the correct lib path (from the original python interpreter) to the env variable 'LIB' the result is the same.

Thanks

nirbheek commented 6 years ago

CCing @MathieuDuponchelle who wrote the module.

guruDanny67 commented 6 years ago

Thanks.

If it was not clear I'm on window, with the last meson (0.46.1) and using pytgon 3.6

To look for the library, in the gvsbuild script, from the python path (say c:\dev\py3-gtk3) I use to look for the libs directory: if it's found I return that dir.

If not I look in lib (without the final s) for a file named orig-prefix.txt: in that file there is the virtualenv origin path (in my case c:\dev\py3-base) and I return that (without recursion, I don't think it's possible to have a virtualenv of a virtualenv).

Thanks

MathieuDuponchelle commented 6 years ago

@nirbheek , gobject-introspection does not use the python module, but the python3 module. Going forward, the python3 module should probably be deprecated in favor of the new module, I cannot be completely affirmative, but I believe porting gi to the new module could very well solve that issue :)

nirbheek commented 6 years ago

gobject-introspection does not use the python module, but the python3 module

Oh, I thought you already ported it to the python module when you did pygobject. I guess that's the fix then.

guruDanny67 commented 6 years ago

I try with the python module but I got two problems: the first is that I cannot get in the meson script the path of the found python (the method found() is ok and it's True but path() gives me an error) and even with the new module the library, running from a virtualenv, is not found.

I don't know if I'm doing something completely wrong, now I'll try to make a small (and simpler than gobject-introspection) test case to see what happen.

Thanks

lazka commented 6 years ago

(For gobject-introspection specifically I wondered if we can just port it to ctypes and skip the C extension stuff)