Skip to content
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

On *NIX systems, gather cross compiling info from sysconfig #139

Merged
merged 1 commit into from
Mar 28, 2021

Conversation

benfogle
Copy link
Contributor

Closes #138

@@ -112,12 +170,15 @@ def build_extension(self, ext: RustExtension, target_triple=None):
"PYO3_PYTHON": os.environ.get("PYO3_PYTHON", sys.executable),
}
)

if target_info.cross_lib:
env.setdefault("PYO3_CROSS_LIB_DIR", target_info.cross_lib)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@davidhewitt
Copy link
Member

Thanks! I'm going to review this together with #134, as they look like two complimentary pieces of the puzzle to me.

I confess I haven't tried cross-compiling Python projects. Have you got a recommended target to cross compile to which I can use to play around with this?

@benfogle
Copy link
Contributor Author

Well, buildroot is a pretty straightforward way of generating Python for cross compiling. Otherwise, I have some prebuilt ones that I use for testing here and here for aarch64-linux-musl and arm-linux-musl.

@davidhewitt davidhewitt force-pushed the cross-compile-info-from-sysconfig branch from a8f3e5c to 035a402 Compare March 28, 2021 16:18
Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much for this. Sorry for the delayed review; I've had to do a fair bit of reading on crossenv and cross-compiling Python to give this review proper attention.

It looks to me like this change is beneficial in general (not just for crossenv) because reading sysconfig is generally a good idea.

I did a force-push to rebase and add a changelog entry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get --target, etc., from sysconfig when cross compiling
3 participants