!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

581 Members
126 Servers

Load older messages


SenderMessageTime
4 Feb 2025
@artturin:matrix.orgArtturin
In reply to @me:linj.tech
but when build != host, you cannot run the link result in checkPhase, right?
You can if build canExecute host
03:02:10
@rosscomputerguy:matrix.orgTristan RossIsh, like what Artturin mentioned. Maybe there's a package out there which builds for host but builds tests for build.03:02:56
@me:linj.techlinjOh, TIL, it is possible that build canExecute host even if build != host03:04:16
@me:linj.techlinjthanks03:05:04
@axman6:matrix.orgAxman6 joined the room.05:55:14
@me:linj.techlinj h0 + t1 in {-1, 0, -1} looks like a typo. I guess it should be h0 + t1 in {-1, 0, 1} 08:20:19
@me:linj.techlinjhttps://nixos.org/manual/nixpkgs/unstable/#ssec-stdenv-dependencies-propagated08:20:27
6 Feb 2025
@jeff:ocjtech.usJeff changed their profile picture.06:08:25
@ss:someonex.netSomeoneSerge (back on matrix) changed their display name from SomeoneSerge (Gand St. Pieters) to SomeoneSerge (UTC+U[-12,12]).17:47:55
@mindtree:matrix.orgmindtree joined the room.22:20:00
@mindtree:matrix.orgmindtree Hey peeps, I'm running into an issue building a rust package derivation for wasm32-unknown-none - I opened a forum post here: https://discourse.nixos.org/t/building-a-rust-package-derivation-using-buildrustpackage-for-wasm32-unknown-unknown 23:24:29
@mindtree:matrix.orgmindtreeAny help appreciated!23:24:31
@kranzes:matrix.orgIlan Joselevich (Kranzes)I only tested this with buildRustCrate/crate2nix (Im the person who made that system type in nixpkgs)23:57:07
@kranzes:matrix.orgIlan Joselevich (Kranzes)You don't need it for buildRustPackags from rustPlatform23:57:58
@kranzes:matrix.orgIlan Joselevich (Kranzes) I believe 23:58:01
@kranzes:matrix.orgIlan Joselevich (Kranzes)I think you just need to set an option to append the --target flag23:58:32
@kranzes:matrix.orgIlan Joselevich (Kranzes) Because we include that wasm32 target in the rustc by default 23:59:05
@kranzes:matrix.orgIlan Joselevich (Kranzes)Because it doesn't require any extra deps23:59:17
7 Feb 2025
@kranzes:matrix.orgIlan Joselevich (Kranzes) * 00:00:00
@mindtree:matrix.orgmindtree

Yeah I looked for this initially, but I wasn't able to find a way to override the flag 🤔

I originally tried something like:

cargoBuildFlags = [ "--target" "wasm32-unknown-unknown" ];

but then the actual build command just ended up with two commands: one for aarch64-apple-darwin and another for wasm32-unknown-unknown.

That lead me to these docs mentioning that the target is derived from the stdenv.hostPlatform.rust.rustcTarget, and digging into that eventually lead me to pkgsCross.wasm32-unknown-none.

Sidenote: I'm very curious about buildRustCrate btw - will have to investigate that another night!

00:04:27
@kranzes:matrix.orgIlan Joselevich (Kranzes)Don't bother with buildRustCrate and crate2nix00:05:11
@mindtree:matrix.orgmindtree *

Yeah I looked for this initially, but I wasn't able to find a way to override the flag 🤔

I originally tried something like:

cargoBuildFlags = [ "--target" "wasm32-unknown-unknown" ];

but then the actual build command just ended up with two targets: one for aarch64-apple-darwin and another for wasm32-unknown-unknown.

That lead me to these docs mentioning that the target is derived from the stdenv.hostPlatform.rust.rustcTarget, and digging into that eventually lead me to pkgsCross.wasm32-unknown-none.

Sidenote: I'm very curious about buildRustCrate btw - will have to investigate that another night!

00:05:38
@kranzes:matrix.orgIlan Joselevich (Kranzes)If you can handle the lack of granularity of buildRustPackage stick to it00:05:45
@kranzes:matrix.orgIlan Joselevich (Kranzes)
In reply to @kranzes:matrix.org
Don't bother with buildRustCrate and crate2nix
I think they're doomed
00:06:00
@kranzes:matrix.orgIlan Joselevich (Kranzes)Crane maybe fine because it's still cargo00:06:11
@kranzes:matrix.orgIlan Joselevich (Kranzes) But reimplementing cargo in Nix is miserable 00:06:31
@kranzes:matrix.orgIlan Joselevich (Kranzes) Way too much work and practically impossible to get right 00:06:48
@kranzes:matrix.orgIlan Joselevich (Kranzes)Anyway, figure out how to do that cross compilation with rustPlatform00:08:45
@mindtree:matrix.orgmindtreeGot this working! Posted a small tutorial on the forum thread: https://discourse.nixos.org/t/building-a-rust-package-derivation-using-buildrustpackage-for-wasm32-unknown-unknown/59925/2?u=mindtree01:05:39
@thing-han:matrix.orgLim, Thing-han joined the room.03:34:18

Show newer messages


Back to Room ListRoom Version: 6