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

add an example of how to compile a Rust project #467

Closed
wants to merge 1 commit into from

Conversation

dae
Copy link
Contributor

@dae dae commented Oct 20, 2021

It took me quite a few hours to figure out how to get a project building with cargo on 0.17, and then figuring out how to get the latest master branch working took time again. Hopefully these small changes make things easier for other people :-)

Related: #466, #439

@indygreg
Copy link
Owner

Thank you for looking into improving the Rust project building! It is an area of PyOxidizer that isn't very polished. Historically, the mean reason for that is the hacks that were required to get a custom libpython linked and for threading state through Cargo so everything just worked in pyoxidizer build mode.

In addition, in the unreleased main branch we ported the Python runtime to the PyO3 crate, which considerably changed the Python pieces of the build. It definitely impacted the already under-documented build a Rust project workflows.

In theory, the switch to PyO3 and the adoption of the Cargo 1.56 (released today) feature to have full control over linker arguments means that having a more natural Rust development workflow with PyOxidizer is now possible! But it will take some work to get there. I have various ideas floating around in my head and your PRs definitely touch on some of them! I'll probably comment on your other PRs eventually. I'm starting with this one because it seemed like a good place to start since documentation improvements are always welcome!

Copy link
Owner

@indygreg indygreg left a comment

Choose a reason for hiding this comment

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

This seems mostly accurate. There are a few pieces that could be tweaked a little (such as encouraging use of PYO3_CONFIG_FILE instead). I'll likely commit this as-is or close to as-is then modify the text slightly in follow-up commits. This will involve me rebasing, so GitHub may not mark this PR as merged due to the Git commit SHA changing.

Thank you for taking the time to contribute your solution to the docs!

@dae
Copy link
Contributor Author

dae commented Oct 23, 2021

Appreciate you taking a look - will keep an eye out for your changes.

@indygreg indygreg closed this in bcccbe3 Oct 23, 2021
@indygreg
Copy link
Owner

I pushed your docs change. Then a few commits later I introduced a new command that specializes in writing out embedding artifacts in commit cdca2e6. This is documented at https://pyoxidizer.readthedocs.io/en/latest/pyoxidizer_rust_generic_embedding.html. I also touched up your docs to add more detail and cut down slightly on the complexity.

Please let me know what you think of the new command and the workflows it enables! Still plenty of room for improvement. But I suspect it will make things vastly easier for people like you!

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.

2 participants