rust: cargo: Use rustc and cargo built on Build for cross-compiling#176694
rust: cargo: Use rustc and cargo built on Build for cross-compiling#176694yorickvP merged 1 commit intoNixOS:masterfrom
Conversation
9dc4996 to
c5e88dd
Compare
|
I think this sort of thing is good to have. |
69f8124 to
b9edc2e
Compare
|
I think this is ready now. |
b9edc2e to
cb932ad
Compare
|
TIL: if you ln -s a directory straight onto the output, it works when nix is installed single user but fails when nix is running as a daemon due to it trying to chown the existing directory. Using lndir instead works. |
|
anything else holding this up other than conflicts? |
6e84ed4 to
5cc8b5c
Compare
|
This does not work with the current version of Rust. The compiler even after being copied to the new location is still looking for core crate exclusively in its original path, and this seems to be the compiled in sysroot ( We can still work around this however, by rewriting this reference in the binary to the new $out. But for that, the derivation name length has to match. |
If it's compiled in, how would a wrapper help? |
|
It can be altered with the |
acebd66 to
101d373
Compare
|
cross-compiling |
|
The std lib produced with fastCross is a stage 0 std lib, and thus does not include LLVM bitcode. https://github.com/rust-lang/rust/blob/master/src/bootstrap/compile.rs#L409 |
0cc5610 to
dd44e56
Compare
|
This should now work (again). Please review. |
dd44e56 to
1df098d
Compare
|
@ofborg build pkgsCross.aarch64-multiplatform.fd |
When cross-compiling a rust package, all we need is the std library compiled for the target. This uses the final stage compiler which was built for Build and then uses that as a stage0 compiler for target std library. It also copies the rust binary from pkgsBuildBuild so that it find the new lib/rustlib directory. We also need to create a cargo wrapper which will use the "new" rust compiler Also makes sure man pages and doc pages are propagated Co-authored-by: Alyssa Ross <hi@alyssa.is> Co-authored-by: Sandro <sandro.jaeckel@gmail.com> Co-authored-by: Rick van Schijndel <Mindavi@users.noreply.github.com>
1df098d to
9ee1043
Compare
|
@ofborg build pkgsCross.aarch64-multiplatform.fd |
|
@ofborg build pkgsCross.musl64.fd |
|
@ofborg build pkgsStatic.fd |
|
Note: pkgsStatic.fd on aarch64-linux breakage is unrelated; was already broken on master |
|
This doesn't appear to have fixed the linked issue, see #207435 (comment). Ping @winterqt |
|
That a rustc derivation appears in the list is to be expected. Within that derivation is should only build the std lib though.
15 Sept 2023 02:03:38 Silvan Mosberger ***@***.***>:
…
This doesn't appear to have fixed the linked issue, see #207435 (comment)[#207435 (comment)]. Ping @winterqt[https://github.com/winterqt]
—
Reply to this email directly, view it on GitHub[#176694 (comment)], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AURNSZN3Y426FJVGFY7BN3TX2OLNJANCNFSM5YCOZKQA].
You are receiving this because you commented.
[Tracking image][https://github.com/notifications/beacon/AURNSZOKZ7GSJ7AXGI4ANELX2OLNJA5CNFSM5YCOZKQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOM2E4KIQ.gif]
|
When cross-compiling a rust package, all we need is the std library compiled
for the target. This uses the final stage compiler which was built for Build
and then uses that as a stage0 compiler for target std library.
It also copies the rust binary from pkgsBuildBuild so that it find the new
lib/rustlib directory.
We also need to create a cargo wrapper which will use the "new" rust compiler
Closes #207435.
Description of changes
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notes