-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
Windows + MSVC: using debug + limited API does not inject a pragma to link to python3_d.lib #107585
Comments
Even better: provide sysconfig options to get the import lib location and then remove this altogether (after a deprecation period) |
… MSVC Signed-off-by: Filipe Laíns <lains@riseup.net>
I definitely think sysconfig should provide this information, but I don't know enough about the MSVC build to evaluate the proposal to remove this entirely. |
Meson would definitely like to not have to deal with this header code. Removing it entirely is a matter of some opinion. It's equivalent to what unix toolchains do, which is that if you need to link to a library, that is the job of the build system (probably your PEP 517 build backend, but potentially embedding libpython into another executable). MSVC has a "clever trick" where you can stick your linker arguments into a header file and forcefully inject those linker arguments into any translation unit that includes said header.
Incidentally, if you follow the discussion on the linked mesonbuild ticket there's a fun reference to pybind11, which plays the trick of undefining Having to monkey-patch the linker like this is the kind of thing that's only necessary because it is forcing linker flags on you even when you're pretty sure you know better than your currently installed version of Maybe an acceptable compromise solution would be for pyconfig.h to include support for a macro such as Footnotes
|
In case it matters at all: I agree with this. I ran into another such
It's be better to get rid of all |
It wouldn't hurt too badly to remove it, though we'd have to make sure that the build backends are all aware of it and adapt their code. Definitely needs a I was sure we'd added a preprocessor option to suppress it, though I don't see it in there now, so perhaps it never made it in for some reason. FWIW, I think linking against a debug build of CPython should be quite an advanced scenario. So if build tools wanted to override the CRT debug option (pass Oh, and I don't think you should redistribute a debug build at all. Debug symbols in some cases, but don't package up modules that expect to load into |
This came up in mesonbuild/meson#11745, where meson on MSVC is overriding the
#pragma (comment lib...
pragma. Shouldn't there be logic to link topython3_d.lib
when using both debug and the limited API? Here is the code in question, it has 3 branches not 4:cpython/PC/pyconfig.h
Lines 310 to 316 in a73daf5
When I install python from https://www.python.org/downloads/windows/ and specify debug symbols in the installer, I do see 4 import libs in the
libs
folder.Linked PRs
The text was updated successfully, but these errors were encountered: