!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

398 Members
92 Servers

Load older messages


SenderMessageTime
1 Oct 2024
@colin:uninsane.orgColin

nix-instantiate -A pkgsCross.aarch64-multiplatform.python3Packages.numpy

08:15:32
@colin:uninsane.orgColinpython packages take about 10x as long to evaluate for cross compilation than non-cross08:15:50
@colin:uninsane.orgColin

this one is 6.4s on my machine (NIX_SHOW_STATS=1) v.s. 0.45s for plain python3Packages.numpy

08:16:31
@colin:uninsane.orgColinfirst: is this reproducible by anyone here, or some quirk with my setup? and second: any idea where to look, or how to workaround this?08:17:21
@artturin:matrix.orgArtturinhttps://github.com/NixOS/nixpkgs/issues/33823108:17:54
@kjeremy:matrix.orgkjeremySeems to be becoming a higher priority13:07:52
@-_o:matrix.org-_o joined the room.20:59:14
4 Oct 2024
@frontear:matrix.orgfrontear joined the room.05:31:56
@f44:matrix.orgf44 joined the room.08:45:30
6 Oct 2024
@sofo:matrix.org@sofo:matrix.org left the room.15:23:50
@suskeyhose:matrix.orgsrasu joined the room.15:51:38
@suskeyhose:matrix.orgsrasuI'm just getting started with a project I'm trying to get to cross compile on nix, and I'm trying to get my feet. Is the cross compilation page on the nix.dev tutorials site still the best place to get started?15:55:15
@suskeyhose:matrix.orgsrasu Right now I'm trying to find what to add to my include directories on nix when on my arch machine it's /usr/x86_64-w64-mingw32/include, which obviously doesn't exist on nix and I can't find enough docs on pkgsCross.mingwW64 to figure out how to find the equivalent directory. 15:58:14
@artturin:matrix.orgArtturin
In reply to @suskeyhose:matrix.org
Right now I'm trying to find what to add to my include directories on nix when on my arch machine it's /usr/x86_64-w64-mingw32/include, which obviously doesn't exist on nix and I can't find enough docs on pkgsCross.mingwW64 to figure out how to find the equivalent directory.
Add your deps to buildInputs and they'll be in your "include" dirs
16:02:50
@artturin:matrix.orgArtturinhttps://github.com/NixOS/nixpkgs/blob/570a50b878ca7654548a493509de3e8175c84364/pkgs/build-support/cc-wrapper/setup-hook.sh#L7216:03:33
@suskeyhose:matrix.orgsrasu
In reply to @artturin:matrix.org
Add your deps to buildInputs and they'll be in your "include" dirs
That's all fine and dandy but I have no idea what package would be the one to be included, because it's not a specific package? It's a part of the mingw runtime.
16:05:29
@artturin:matrix.orgArtturin ++ lib.optional stdenv.hostPlatform.isMinGW windows.mingw_w64 16:06:55
@suskeyhose:matrix.orgsrasuthanks, I'll give that a shot16:07:26
@artturin:matrix.orgArtturin
nix-repl> pkgsCross.mingwW64.windows
{
  callPackage = { ... };
  crossThreadsStdenv = «derivation /nix/store/7pn0mi0ifhmxxqcmm0y0i2i0pi3hviq8-stdenv-linux.drv»;
  cygwinSetup = «derivation /nix/store/j9nxv205rwvrl1y4k4mjjy1zcdwliv55-cygwin-setup-x86_64-w64-mingw32-20131101.drv»;
  dlfcn = «derivation /nix/store/zsr99i1s18902ns6h3dssagicgm5xzal-dlfcn-x86_64-w64-mingw32-1.3.1.drv»;
  libgnurx = «derivation /nix/store/ldslf0cx0m3y5665dlm7w0vgkmf4f8ls-libgnurx-x86_64-w64-mingw32-2.5.1.drv»;
  mcfgthreads = «derivation /nix/store/gph336lb24llfljpa9cplb7hrp7cpl9r-mcfgthread-x86_64-w64-mingw32-1.6.1.drv»;
  mingw_runtime = «derivation /nix/store/47q84dw3vzys2v55jpfss27qmd36mpm5-mingwrt-x86_64-w64-mingw32-5.0.2.drv»;
  mingw_w64 = «derivation /nix/store/lk181ykl0ks0d8k8b0imd1qjkf5bkbih-mingw-w64-x86_64-w64-mingw32-11.0.1.drv»;
  mingw_w64_headers = «derivation /nix/store/wzdl8xnhd2i0a11mlgnkap9dp7lhps6m-mingw_w64-headers-11.0.1.drv»;
  mingw_w64_pthreads = «derivation /nix/store/xppqqfvly2vydnm05w26x0qx4ddhmk99-mingw_w64-pthreads-x86_64-w64-mingw32-11.0.1.drv»;
  mingwrt = «derivation /nix/store/47q84dw3vzys2v55jpfss27qmd36mpm5-mingwrt-x86_64-w64-mingw32-5.0.2.drv»;
  newScope = { ... };
  npiperelay = «derivation /nix/store/m18c6j9d2a5hvz35s9qqv00czy6x3x1f-npiperelay-x86_64-w64-mingw32-0.1.0.drv»;
  overrideScope = { ... };
  overrideScope' = { ... };
  packages = { ... };
  pthreads = «derivation /nix/store/v392vvmy3rkqf7y0b5alz0sf687yvv4i-pthreads-w32-x86_64-w64-mingw32-2.9.1.drv»;
  w32api = «derivation /nix/store/pkyqn9n95q6s079wgwr5hnd9dlp803cx-w32api-x86_64-w64-mingw32-3.17-2.drv»;
}
16:07:28
@artturin:matrix.orgArtturin mingw_w64_headers 16:09:02
@suskeyhose:matrix.orgsrasuthat's gotten me closer than I've gotten before with nix, now I'm not running into issues with the wrong sizes of stdint being defined, which is good16:09:10
@artturin:matrix.orgArtturin * mingw_w64_headers EDIT mingw_w64 contains headers, there's a separate package for bootstrapping reasons it seems 16:10:20
@suskeyhose:matrix.orgsrasuOk, now I'm back to getting libblocksruntime to be visible to the target, but I've dealt with that some before16:11:56
@artturin:matrix.orgArtturin You can --keep-failed and check the env-vars in the dir in /tmp 16:13:20
@artturin:matrix.orgArtturinWhat's your error, is the lib in buildInputs?16:14:26
@artturin:matrix.orgArtturinShow the expr16:15:11
@suskeyhose:matrix.orgsrasu

doing a devShell

          devShells.default = pkgs.mkShell {
            packages = with pkgs; [
              bear
              doxygen
              nodejs
              lldb_18
              llvmPackages_18.bintools
              clang-tools_18
              valgrind
              man-pages
              man-pages-posix
            ];

            nativeBuildInputs = with pkgs; [
              llvmPackages_18.clang
              pkg-config
              wine64
            ] ++ (with windows-pkgs.pkgsCross.mingwW64.buildPackages; [
              llvmPackages_18.clang
            ]);

            buildInputs = with pkgs; [
              libblocksruntime
            ] ++ (with windows-pkgs.pkgsCross.mingwW64.buildPackages; [
              libblocksruntime
            ]);

            NOVENDOR = "yes";
            DEBUG = "yes";
            LEAKCHECK = "yes";
            UBSAN_OPTIONS="suppressions=template.supp";
            hardeningDisable = [ "all" ];
            CPATH = "${pkgs.llvmPackages_18.clang}/resource-root/include:${pkgs.glibc.dev}/include";
            WINCPATH = with pkgs.pkgsCross.mingwW64.buildPackages;
              "${llvmPackages_18.clang}/resource-root/include";
          };
16:16:11
@suskeyhose:matrix.orgsrasuthat windows-pkgs is just an extra nixpkgs with an override on libblocksruntime that patches the builder to use the mingw compiler16:17:00
@suskeyhose:matrix.orgsrasuwithout it the build fails16:17:08
@suskeyhose:matrix.orgsrasuit's on a custom makefile which replaces cpath with wincpath for cross compilation16:18:18

Show newer messages


Back to Room ListRoom Version: 6