!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

397 Members
92 Servers

Load older messages


SenderMessageTime
25 Aug 2024
@themojken:matrix.orgthemojkenOh, that won't work, because it needs to access the store to evaluate the derivations...09:18:16
@themojken:matrix.orgthemojkenHuh, it's undocumented, but nix-build actually takes a --store argument that does almost exactly what I want09:44:39
@themojken:matrix.orgthemojkenLike, it put 490 things in there when I really only wanted three, only 39 if I filter for the platform suffix, 23 if I filter out directories. The extras are mostly alternative outputs of packages, such as -dev ones, as well as libraries I have built but then statically linked. Using the store, it might be worth going over to dynamic links after all, though.09:50:42
@lukas.voreck:matrix.studverthi.deLukas Voreck joined the room.13:30:52
@lukas.voreck:matrix.studverthi.deLukas Voreck

Hey there. im trying to cross compile a rust project from nixos to windows. The relevant part of my flake looks like this

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
  };

  outputs =
    { nixpkgs, ... }:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs { inherit system; };
      windows-pkgs = pkgs.pkgsCross.mingwW64;
    
    in
    {
        windows-cross = windows-pkgs.rustPlatform.buildRustPackage rec {
          pname = "rustyjeb";
          version = "0.1.0";

          buildInputs = [ ];

          cargoLock.lockFile = ./Cargo.lock;
          src = windows-pkgs.lib.cleanSource ./.;
        };
      };
    };
}

But building it gives me this error

       > error: Error calling dlltool 'x86_64-w64-mingw32-dlltool': No such file or directory (os error 2)
       >
       > error: could not compile `std` (lib) due to 1 previous error
       > Build completed unsuccessfully in 0:00:49
       For full logs, run 'nix log /nix/store/l9fk14vfyk2dbmivg5c75j7y7dszl4hd-x86_64-w64-mingw32-rustc-1.80.1.drv'.
error: 1 dependencies of derivation '/nix/store/5d2920ccqcjymhrlxv9sa4d8wrv0wk6n-x86_64-w64-mingw32-rustc-wrapper-1.80.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/zf42b74j4caj4jlx7qrjr2h1s7vnhb05-rustyjeb-x86_64-w64-mingw32-0.1.0.drv' failed to build
13:33:22
@k900:0upti.meK900mingw isn't well supported13:46:10
@k900:0upti.meK900Maybe look into something like https://gitlab.com/K900/rust-cross-windows13:46:17
@qyliss:fairydust.spaceAlyssa RossThe LLVM bintools should have dlltool13:48:44
@qyliss:fairydust.spaceAlyssa Ross

Put buildPackages.llvmPackages.bintools in nativeBuildInputs?

13:49:31
@qyliss:fairydust.spaceAlyssa Rosshmm, although I think so should the default stdenv...13:50:50
@qyliss:fairydust.spaceAlyssa RossI guess we just need bintools for the target in rustc?14:00:53
@qyliss:fairydust.spaceAlyssa RossPR incoming :)14:07:08
@lukas.voreck:matrix.studverthi.deLukas Voreck
In reply to @qyliss:fairydust.space

Put buildPackages.llvmPackages.bintools in nativeBuildInputs?

with that i get this error > mv: cannot stat 'expand-response-params': No such file or directory
14:10:20
@qyliss:fairydust.spaceAlyssa RossYeah, I'd misread the error when I said that. It needs to go in rustc's depsBuildTarget.14:10:56
@lukas.voreck:matrix.studverthi.deLukas VoreckErr... how do i do that?14:13:31
@qyliss:fairydust.spaceAlyssa Ross
In reply to @qyliss:fairydust.space
PR incoming :)
^
14:13:54
@qyliss:fairydust.spaceAlyssa Rosshttps://github.com/NixOS/nixpkgs/pull/33725114:16:13
@lukas.voreck:matrix.studverthi.deLukas VoreckAlready aproved lol14:37:46
@qyliss:fairydust.spaceAlyssa Ross

With that change I can build pkgsCross.mingwW64.fd

14:45:58
@lukas.voreck:matrix.studverthi.deLukas Voreckcan i use your branch in my flake before it's merged?14:52:53
@qyliss:fairydust.spaceAlyssa Rossyou can14:54:10
@qyliss:fairydust.spaceAlyssa Ross(I don't know how to, if that's what your asking, but somebody else here probably dose)14:54:44
@qyliss:fairydust.spaceAlyssa Ross * 14:54:53
@qyliss:fairydust.spaceAlyssa Ross * 14:55:07
@lukas.voreck:matrix.studverthi.deLukas Voreck I assume nixpkgs.url = "github:alyssais/nixpkgs/tree/rustc-mingw"; 14:55:19
@lukas.voreck:matrix.studverthi.deLukas VoreckYup, it works now!15:04:14
@qyliss:fairydust.spaceAlyssa RossMerged15:25:09
@lukas.voreck:matrix.studverthi.deLukas Voreckhow long does it take until it lands in unstable?15:30:08
@qyliss:fairydust.spaceAlyssa Rossfew days15:30:21
@lukas.voreck:matrix.studverthi.deLukas Voreckalright. thank you!15:32:11

Show newer messages


Back to Room ListRoom Version: 6