-
Notifications
You must be signed in to change notification settings - Fork 784
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
Add PYO3_CROSS_NO_ENABLE_SHARED
variable
#1532
Conversation
f5463a5
to
1a63a7b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for implementing this. I have a couple of comments regarding the copy.
Also, for this to be useful for users we would need to remove the cfg-gates I put in gil.rs
:
Line 73 in f97aac6
#[cfg(all(Py_SHARED, not(PyPy)))] |
Line 140 in f97aac6
#[cfg(all(Py_SHARED, not(PyPy)))] |
However I'm a bit worried about doing so. I added those because we got a lot of users having problems with statically-linked tests. 😄
Sorry, I don't quite understand why it is gated on I grepped the current CPython sources for EDIT: I've checked the Python 3.6 sources as well, and nothing seems to have changed since then. |
Yes, those See original PR in #1347 |
.... I am wondering if perhaps the right thing to do is remove those I'll try to put together a PR for this case tonight. |
I still can't figure out why is it illegal to call But assuming it is, then |
Apologies, I'm communicating poorly - it is fine to call Give me a few days to try out some experiments and write some documentation in a new PR. Then I will come back to re-review this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I think this is OK, but let's wait a bit for David to come up with a good document.
Ok, so as per #416 (comment) I was able to prove that linking a static python can work. It is however super awkard so not something we can support first-class in PyO3 at the moment. Given that this PR affects windows, I'm going to try to repeat a similar experiment on Windows and see what makes sense to change / put into documentation. |
AFAIK on Windows the extensions can't import symbols from the embedding executable because the Python DLL name gets hardcoded into the extension modules. One could theoretically build a fake |
4001d4a
to
c0988f6
Compare
👍 that sounds about right based on the reading I've been doing too. Thanks for this; I'm satisfied let's merge it and I'll add a follow-up PR shortly to unlock more pyo3 functionality when linking statically. |
It allows to override the default value of `Py_ENABLE_SHARED` definition in `pyconfig.h` when cross-compiling for Windows. Equivalent to defining `Py_NO_ENABLE_SHARED` when building a C program statically linking the Python interpreter.
c0988f6
to
fca76ea
Compare
Obsoleted by #1553 |
It allows to override the default value of
Py_ENABLE_SHARED
definition in
pyconfig.h
when cross-compiling for Windows.Equivalent to defining
Py_NO_ENABLE_SHARED
when buildinga C program statically linking the Python interpreter.