-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
just: fix cross-compilation #351032
base: master
Are you sure you want to change the base?
just: fix cross-compilation #351032
Conversation
pkgs/by-name/ju/just/package.nix
Outdated
src | ||
cargoHash | ||
; | ||
nativeBuildInputs = [ buildPackages.mdbook ]; |
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.
Given this is a build dependency for a build dependency, it should come from pkgsBuildBuild. (But also if you just use "mdbook" splicing should do the right thing.)
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.
An easier and more portable approach would probably be to just copy the documentation from buildPackages.just when cross compiling.
1c081f1
to
285d69c
Compare
Thanks for the tip! I wasn't sure how to best handle it in this case. For native compilation we buid the docs if It's a bit more work to compile |
|
Also able to build |
) | ||
+ lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) '' | ||
${just} --man > ./just.1 | ||
installManPage ./just.1 |
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.
Why aren't we copying this from buildPackages.just as well?
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've looked back on the solution with the copying and it doesn't really sit well with me.
I refactored generate-book
to use emulation. As it turns out it's not a bottleneck at all and takes very little time even under emulation.
Sorry for the back and forth
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.
Emulation should really only be used where it's a last resort, because we don't have emulators for every platform we might want to cross compile to.
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.
We've discussed it a bit here #351032, but I don't have a clear opinion on this
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.
Wrong link?
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.
Oh #308283
285d69c
to
4986a17
Compare
4986a17
to
7e32534
Compare
Rebased and updated. Since there still doesn't seem to be an agreement on how to handle cross-compilation for generating shell completions and documentation, I've stuck with the current consensus and skip those steps based on |
Get rid of calls to `cargo run` in a, which lead to cargo TARGET and CC to be out of sync for cross-compilation. Only build man pages, shell completions and source for the docs when `stdenv.buildPlatform.canExecute stdenv.hostPlatform`, as this seems to be the current consensus.
7e32534
to
596dfcb
Compare
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.
Non-blocking suggestion to help any future reviewers of the code.
I'm happy with this method or copying results from buildPackages
. Emulation methods are fun but as discussed in the other issue require an excessively large closure and can be brittle.
Co-authored-by: j-k <[email protected]>
Fixes #320569.
Get rid of calls to
cargo run
in a, which lead to cargo TARGET and CCto be out of sync for cross-compilation.
Use emulator to build man pages, shell completions and source for the docs.
With this change I'm able to build
pkgsCross.aarch64-multiplatform.just
as well aspkgsCross.aarch64-multiplatform.pkgsStatic.just
fromx86_64-linux
.Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.