!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

580 Members
129 Servers

Load older messages


SenderMessageTime
7 Jun 2026
@richarddodd:matrix.orgricharddodd joined the room.14:19:10
@richarddodd:matrix.orgricharddodd Hey - I'm trying to do some cross x64 -> aarch64 and am finding some packages aren't building (RN it's tree-sitter). Is there a guide somewhere for how to go about debugging packages in the nixpkgs repo? 14:20:24
@k900:0upti.meK900 There's really no simple answer here 14:20:51
@k900:0upti.meK900Very few upstreams actually test cross compilation14:20:59
@k900:0upti.meK900 So the process is usually "look at the build error really hard and try to figure out what's going wrong" 14:21:17
@richarddodd:matrix.orgricharddodd I'm happy to debug the build - I just need to figure out how to go from nixpkgs to a shell.nix or similar. 14:21:35
@richarddodd:matrix.orgricharddodd * I'm happy to debug the build - I just need to figure out how to go from nixpkgs/../package.nix to a shell.nix or similar. 14:21:51
@richarddodd:matrix.orgricharddodd In my case the error is unknown type name '__SVFloat32_t', so I suspect fixing it will involve providing some SVE symbols or perhaps turning SVE usage off when cross-compiling 14:24:29
@k900:0upti.meK900 nix-shell -A <foo> 14:25:00
@k900:0upti.meK900 Or rather, in your specific case, probably nix-shell -A pkgsCross.aarch64-multiplatform.foo 14:25:14
@richarddodd:matrix.orgricharddoddWould that use my own local copy of nixpkgs, so I can start debug/run cycling?14:26:21
@richarddodd:matrix.orgricharddodd oh - I think I understand - I go to the root of nixpkgs and then run that to use a particular attribute rather than the root attribute? 14:28:20
@k900:0upti.meK900Yes14:28:50
@richarddodd:matrix.orgricharddoddI think that was the thing I wasn't understanding. Thanks14:29:14
@zimward:zimward.moezimward changed their display name from zimward @GPN24 to zimward.21:07:32
8 Jun 2026
@9lore:tchncs.de9lore changed their display name from 9lore | call LORE to 9lore.00:35:30
10 Jun 2026
@eureka-cpu:matrix.orgeureka-cpu

is there a guide for how to use windows.pthreads? I have some rust code I'm trying to cross compile from x86_64-linux to mingw-ucrt-x86_64-llvm, but hit a snag on needing pthreads. I added it but then I get the supported platform error since it doesn't include any platforms. What's the intended way of using it? Forgive my sloppy code, but here's what I currently have:

          test-cargo-reaper-build-cross-windows =
            let
              inherit (pkgs.lib.systems.examples.mingw-ucrt-x86_64-llvm.rust) rustcTarget;
              crossPkgs = pkgs.pkgsCross.mingw-ucrt-x86_64-llvm;
              mingwCC = crossPkgs.stdenv.cc;
              crossCC = "${mingwCC}/bin/${mingwCC.targetPrefix}cc";
              crossCXX = "${mingwCC}/bin/${mingwCC.targetPrefix}c++";

              rustWithWindowsTarget = fenix.packages.${system}.combine [
                rustToolchain
                (fenix.packages.${system}.targets.${rustcTarget}.toolchainOf {
                  channel = "1.87.0";
                  sha256 = "sha256-KUm16pHj+cRedf8vxs/Hd2YWxpOrWZ7UOrwhILdSJBU=";
                }).rust-std
              ];
              craneLibCross =
                let
                  craneLib = (crane.mkLib pkgs).overrideToolchain rustWithWindowsTarget;
                in
                craneLib // (cargoReaper.crane { inherit craneLib; });

              crossArgs = {
                src = testFileset ./tests/plugin_manifests/package_manifest;
                strictDeps = true;

                nativeBuildInputs = [
                  mingwCC
                  pkgs.llvmPackages.bintools
                  pkgs.windows.pthreads
                ];

                CARGO_BUILD_TARGET = rustcTarget;
                CARGO_TARGET_X86_64_PC_WINDOWS_GNULLVM_LINKER =
                  "${mingwCC}/bin/${mingwCC.targetPrefix}cc";
                "CC_${rustcTarget}" = crossCC;
                "CXX_${rustcTarget}" = crossCXX;
              };
              cargoArtifactsCross = craneLibCross.buildDepsOnly crossArgs;
            in
            craneLibCross.buildReaperExtension (crossArgs // {
              cargoArtifacts = cargoArtifactsCross;
              package = "package_manifest";
              plugin = "reaper_package_ext";
              target = rustcTarget;
              doInstallCheck = true;
              installCheckPhase = ''
                test -f $out/lib/reaper_package_ext.dll
              '';
            });
18:28:06
@eureka-cpu:matrix.orgeureka-cpu *

is there a guide for how to cross compile to windows? I have some rust code I'm trying to cross compile from x86_64-linux to mingw-ucrt-x86_64-llvm, but hit a snag on needing pthreads. I added it but then I get the supported platform error since it doesn't include any platforms. What's the intended way of using it? Forgive my sloppy code, but here's what I currently have:

          test-cargo-reaper-build-cross-windows =
            let
              inherit (pkgs.lib.systems.examples.mingw-ucrt-x86_64-llvm.rust) rustcTarget;
              crossPkgs = pkgs.pkgsCross.mingw-ucrt-x86_64-llvm;
              mingwCC = crossPkgs.stdenv.cc;
              crossCC = "${mingwCC}/bin/${mingwCC.targetPrefix}cc";
              crossCXX = "${mingwCC}/bin/${mingwCC.targetPrefix}c++";

              rustWithWindowsTarget = fenix.packages.${system}.combine [
                rustToolchain
                (fenix.packages.${system}.targets.${rustcTarget}.toolchainOf {
                  channel = "1.87.0";
                  sha256 = "sha256-KUm16pHj+cRedf8vxs/Hd2YWxpOrWZ7UOrwhILdSJBU=";
                }).rust-std
              ];
              craneLibCross =
                let
                  craneLib = (crane.mkLib pkgs).overrideToolchain rustWithWindowsTarget;
                in
                craneLib // (cargoReaper.crane { inherit craneLib; });

              crossArgs = {
                src = testFileset ./tests/plugin_manifests/package_manifest;
                strictDeps = true;

                nativeBuildInputs = [
                  mingwCC
                  pkgs.llvmPackages.bintools
                  pkgs.windows.pthreads
                ];

                CARGO_BUILD_TARGET = rustcTarget;
                CARGO_TARGET_X86_64_PC_WINDOWS_GNULLVM_LINKER =
                  "${mingwCC}/bin/${mingwCC.targetPrefix}cc";
                "CC_${rustcTarget}" = crossCC;
                "CXX_${rustcTarget}" = crossCXX;
              };
              cargoArtifactsCross = craneLibCross.buildDepsOnly crossArgs;
            in
            craneLibCross.buildReaperExtension (crossArgs // {
              cargoArtifacts = cargoArtifactsCross;
              package = "package_manifest";
              plugin = "reaper_package_ext";
              target = rustcTarget;
              doInstallCheck = true;
              installCheckPhase = ''
                test -f $out/lib/reaper_package_ext.dll
              '';
            });
18:49:17
@eureka-cpu:matrix.orgeureka-cpu

Ah so the pthreads problem was with libc, it hasn't even gotten to my build yet:

Cannot build '/nix/store/2qixrw546lxpxqkwyglhzhhnf2m7kv2b-compiler-rt-libc-x86_64-w64-mingw32-21.1.8.drv'
19:58:03
@eureka-cpu:matrix.orgeureka-cpuIs mingw just broken atm?19:58:57
@eureka-cpu:matrix.orgeureka-cpu * Is mingw-ucrt-x86_64-llvm just broken atm? 19:59:55
@symphorien:xlumurb.eusymphoriencross compiling is best effort as a general rule20:20:13
@symphorien:xlumurb.eusymphorienmeaning that if nobody cares about a specific triple enough to compile stuff regularly with it and to contribute fixes, it will most probably be broken20:21:42
11 Jun 2026
@eureka-cpu:matrix.orgeureka-cpu I was able to make it work with mingwW64 and some extra environment variables. mingw-ucrt-x86_64-llvm is indeed borked at the moment. 02:54:09
@rosssmyth:matrix.org@rosssmyth:matrix.org Yeah the ucrt code paths are not as well tested. Crane also has weird cross behavior itself, and rustPlatform is more reliable for Rust cross. If you cannot got it to cross with rustPlatform, you can open an issue on Nixpkgs with some logs and an MVP, and post in #windows:nixos.org. One of us may look into it. 15:21:59
@eureka-cpu:matrix.orgeureka-cpuThe crane cross story has gotten more reliable not too long ago15:47:46
@eureka-cpu:matrix.orgeureka-cpuI'll give that a try though if I get an ABI mismatch. Was trying to compile a DLL for an application.15:48:13
23 May 2021
@grahamc:nixos.org@grahamc:nixos.org set the history visibility to "world_readable".12:31:03
@grahamc:nixos.org@grahamc:nixos.org changed the room name to "" from "".12:31:03
@grahamc:nixos.org@grahamc:nixos.org invited @qyliss:fairydust.spaceAlyssa Ross.12:31:18

Show newer messages


Back to Room ListRoom Version: 6