-
-
Notifications
You must be signed in to change notification settings - Fork 18k
Setuptools rust hook for cross compilation #212795
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,18 @@ | ||||||||||
| echo "Sourcing setuptools-rust-hook" | ||||||||||
|
|
||||||||||
| setuptoolsRustSetup() { | ||||||||||
| # This can work only if rustPlatform.cargoSetupHook is also included | ||||||||||
| if ! command -v cargoSetupPostPatchHook >/dev/null; then | ||||||||||
Cynerd marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||
| echo "ERROR: setuptools-rust has to be used alongside with rustPlatform.cargoSetupHook!" | ||||||||||
| exit 1 | ||||||||||
| fi | ||||||||||
|
|
||||||||||
| export PYO3_CROSS_LIB_DIR="@pyLibDir@" | ||||||||||
| export CARGO_BUILD_TARGET=@cargoBuildTarget@ | ||||||||||
| # TODO theoretically setting linker should not be required because it is | ||||||||||
| # already set in pkgs/build-support/rust/hooks/default.nix but build fails | ||||||||||
| # on missing linker without this. | ||||||||||
| export CARGO_TARGET_@cargoLinkerVar@_LINKER=@targetLinker@ | ||||||||||
|
||||||||||
| # TODO theoretically setting linker should not be required because it is | |
| # already set in pkgs/build-support/rust/hooks/default.nix but build fails | |
| # on missing linker without this. | |
| export CARGO_TARGET_@cargoLinkerVar@_LINKER=@targetLinker@ |
If you need this, it means splicing isn't working right. That's usually caused by referencing things via rustPlatform. Don't do that. Use my next suggestion instead.
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.
I don't understand how not to use rustPlatform. How can I access the cargoSetupHook unless I am using buildRustPackage or through rustPlatform? I can't use buildRustPackage because this is a Python hook primarily.
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.
I don't understand how not to use
rustPlatform.
Let me be more explicit:
If you need this, it means splicing isn't working right. That's usually caused by referencing
thingsrustc and cargo viarustPlatform. Don't do that. Use my next suggestion instead.
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.
It appears that you have applied this suggestion.
Uh oh!
There was an error while loading. Please reload this page.