-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 include directory when cross compiling #9129
Conversation
I'm concerned this may have the practical effect of reverting aa8dbd8, particularly since we have no ability to test any of these cross-compilation patterns in CI. Is there any reasonable way to validate this works correctly? |
I think it's probably not going to cause issues as
I'm not all that familiar with how yocto handles python cross compilation here. |
Perhaps a dumb question, but I don't see |
It's set here I think. |
Ah, so it's merely under-documented.
…On Fri, Jun 23, 2023 at 6:44 PM James Hilliard ***@***.***> wrote:
is this an official thing
It's set here I think.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
--
All that is necessary for evil to succeed is for good people to do nothing.
|
@kanavin can you confirm that this PR doesn't have a negative impact on your cross-compilation? |
On our setup 'headers' is not present at all:
Reading the code for sysconfig, 'headers' entry is only present if python is called from its own source/build directory, and so shouldn't be relied on for building other items, such as this one :) It's not documented for the same reason. |
I'd also like to ask @jameshilliard , how do you get the sysroot prefix from the build host into these paths reported by sysconfig? Yocto doesn't do it, assuming sysconfig should be reporting target paths. Rather, we patch the sysroot prefix into specific variables in _sysconfigdata.py. Python cross-compile is a mess. |
I found it: I don't have a clear idea yet how we can meet in the middle, need to research further. |
Okay, sorry for the flood. @alex The more I look at it, the more I'm convinced that "sysconfig.get_path ('include')" was correct all along. I'd suggest at this point that my change is reverted as well - both yocto and buildroot need to figure out how to make that work without having to patch components such as this one. |
Yeah...I think to some degree we're treating our 3rd party python package builds somewhat like python stdlib module builds. I recall that approach was the least broken and that this patch was related.
Very true, and it's largely undocumented as well with everyone handling things slightly differently, rust is pretty bad at cross compilation as well considering setting env variables with names like
Well if
Yeah, I agree |
It popped up in that commit because we fundamentally changed how we build and link openssl with that work. We needed to do this so we could link rust-openssl against the same copy of openssl that we use for the cffi layer. |
…t in cross builds (pyca#9105)" The original code was right all along: it uses the official API for obtaining header locations, and it is on the build environment to ensure python supplies that in cross-build scenarios (another option is to apply a custom patch, however any such patch is not eligible for upstream submission due to its specificity). Further info: pyca#9129
…t in cross builds (#9105)" (#9131) The original code was right all along: it uses the official API for obtaining header locations, and it is on the build environment to ensure python supplies that in cross-build scenarios (another option is to apply a custom patch, however any such patch is not eligible for upstream submission due to its specificity). Further info: #9129 Co-authored-by: Alexander Kanavin <alex@linutronix.de>
I submitted a revert PR to my change. Yocto will carry the fix locally and mark it as unsuitable for upstream submission. (and we need to seriously look into cross-building python in a better way). I cannot agree that using undocumented API is harmless, 'headers' or otherwise. It's problematic for two reasons:
I'd suggest that this change stays local to buildroot as well, as it is very much specific to that environment (running python out of its build tree) and is unlikely to be useful elsewhere. |
a5873f9
to
e411697
Compare
Was this include directory not being used anywhere in the build previously? I'm wondering if there's a different way of pulling this directory that wouldn't trigger this issue that is being used in other places.
Well anything related to python cross compilation tends to be poorly or entirely undocumented in general, I updated the PR to add a comment to indicate how
That's not all that clear, it seems to be used by distutils/setuptools based on what I'm seeing here in some situations which would indicate that the behavior should be semi-stable as long as it's used similar to distutils/setuptools.
To clarify we're not actually running python out of its build tree for these 3rd party module builds, we're setting the sysconfig environment up similar to how module builds from within the python build tree work from my understanding but still running the host python binary itself from its out of tree location. |
Previously the include directory was being found somewhere inside of setuptools logic. My preference would be to just reproduce whatever it's doing (that's what we thought we were doing with the sysconfig usage, but perhaps there's a subtly we're missing). |
It looks like it might be here, not entirely sure I've traced this properly however. |
Note that the sysconfig there is _not_ the stdlib sysconfig module,
its distutils.sysconfig. This looks plausible though, I think we'd be
happy to take a patch that emulated this.
…On Sat, Jun 24, 2023 at 10:10 PM James Hilliard ***@***.***> wrote:
Previously the include directory was being found somewhere inside of setuptools logic.
It looks like it might be here, not entirely sure I've traced this properly however.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
--
All that is necessary for evil to succeed is for good people to do nothing.
|
Seems easier and probably more reliable to just pass the include_dirs via an env variable from setuptools-rust like this. |
e411697
to
635eaf5
Compare
@jameshilliard @kanavin can you both confirm that this latest version works for your setups? Seems like it should, which will be great, and we can put this cursed issue to bed :-) |
Yeah, seems to work for me. |
Works for me as well, thanks! |
Fixes #9119.