-
Notifications
You must be signed in to change notification settings - Fork 86
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
Improve cross-compilation example #4
Comments
Thanks for the detailed config, definitely helps reproduce things locally! I think the root of the issue is the fact that Line 16 in 5afc3e9
My original assumption was that we don't want to generate artifacts for a On one hand we can make this configurable (default to not installing cargo artifacts but allow the caller to specify they want to), but it could be a discoverability issue. On the other hand, we can let the artifacts be installed by default, but it would waste cycles for most projects which don't know about the nitty gritty details... |
Ah, seems like I was being bitten by an issue unrelated to cross-compiling, oops! I removed the
I suspect |
@lovesegfault if you're interested in adding a cross-compilation example I'd be happy to merge it in! Otherwise I'll try to add one when I get some free time |
I'm working on it, but I haven't been able to get it to work yet. One issue I'm having is that it seems to always want to compile You can check this by doing a I haven't been able to understand why it always tries to cross-compile rustc. |
The more I think about this, the more certain I am that something is wrong here: Lines 18 to 24 in 0125041
I haven't been able to figure out the issue though. |
I placed a complete reproducer here: https://github.com/lovesegfault/crane-cross-example It's really interesting that Suggest something about |
crane/lib/mkCargoDerivation.nix Lines 51 to 55 in 0125041
I wonder whether these should come from I still feel like the |
It's entirely possible, I'll admit I wasn't thinking about cross compilation at all 😅
Probably shouldn't matter for the shell scripts (but could be good for consistency). Wonder where Technically the rust compiler is a first-class cross compiler (as long as you have the right targets imported), but not sure how it plays out with the versions that are available in nixpkgs. Maybe cargo needs to be |
I've been (re)reading through the cross compilation section of the manual to better understand the correct way to configure expressions. It sounds like thanks to some package splicing logic things "should" work as long as dependencies are correctly scoped in their dependency types (e.g. I'll play around with the repro example when I get a chance and try to see what could be suspect there. One thing which comes to mind is the fact that crane will specify |
Figured out the issue, it had to do with pkg splicing not happening automatically. Should have a fix in sometime this week! |
Currently, the cross-compilation example instantiates
nixpkgs
like so:crane/examples/custom-toolchain/flake.nix
Lines 23 to 26 in 5afc3e9
And proceeds as usual, only referencing the custom toolchain when instantiating
craneLib
:crane/examples/custom-toolchain/flake.nix
Lines 28 to 40 in 5afc3e9
This is AOK if you don't have any system dependencies, but it would be great if an example were added showing how to use
crane
together withcrossSystem
, akin to the example in rust-overlay: https://github.com/oxalica/rust-overlay/blob/master/examples/cross-aarch64/shell.nix.I've attempted to get this to work with the following (truncated) snippet:
But it fails with the following:
You should be able to reproduce this with
nix build -L
on https://github.com/lovesegfault/hyperpixel-init on thecrane
branch.The text was updated successfully, but these errors were encountered: