!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

582 Members
127 Servers

Load older messages


SenderMessageTime
7 May 2025
@szlend:matrix.orgszlendThis is my understanding of how perspective shifts, but I could be very wrong: https://gist.github.com/szlend/62bfa710ff89b7dc3a871693ca34c94c21:22:38
@szlend:matrix.orgszlendSo I kinda wanna confirm it :D21:22:45
@ss:someonex.netSomeoneSerge (back on matrix) Does root refer to the current derivation? 21:25:44
@k900:0upti.meK900 Can you not overlay it on pkgs? 21:27:35
@szlend:matrix.orgszlendI'm thinking about it like root == pkgsCross.<platform> == pkgsCross.<platform>.pkgsHostTarget (assuming those are equivalent)21:27:44
@szlend:matrix.orgszlendso pkgsCross.<platform>.pkgsBuildHost.pkgsBuildTarget == pkgsCross.<platform>.pkgsHostHost21:28:39
@szlend:matrix.orgszlend * so pkgsCross.<platform>.pkgsBuildHost.pkgsTargetTarget == pkgsCross.<platform>.pkgsHostHost 21:28:57
@szlend:matrix.orgszlendor maybe root.pkgsBuildHost.pkgsTargetTarget == root.pkgsHostTarget (since targetTarget is +1,+1)21:36:15
@ss:someonex.netSomeoneSerge (back on matrix) It's the former, because ps: ps.pkgsTargetTarget translates by the vector of (1, 0), which is how you get from the point (0, 1) (pkgs = pkgsHostTarget) to the point (1, 1) (pkgs.pkgsTargetTarget) 21:41:55
@ss:someonex.netSomeoneSerge (back on matrix) Setup-hooks here print the accumulated vectors, but not the result of translating the current' derivation's platforms (0, 1) by that vector 21:44:01
@szlend:matrix.orgszlendI see yeah, thanks! I think I actually got it then21:48:52
8 May 2025
@98765abc:mozilla.org98765abc changed their profile picture.11:35:04
@curid:matrix.org@curid:matrix.orgRedacted or Malformed Event19:03:13
@curid:matrix.org@curid:matrix.org Is there a better way to write this?
NIX_CFLAGS_COMPILE = if pkgs.system == "aarch64-unknown-linux-gnu" then "" else "-msse4.2"
19:14:52
@k900:0upti.meK900 if !stdenv.hostPlatform.isx86 19:17:58
@k900:0upti.meK900Or rather19:18:10
@k900:0upti.meK900 lib.optionalString stdenv.hostPlatform.isx86 "-msse4.2" 19:18:21
9 May 2025
@curid:matrix.org@curid:matrix.org
let
  # latest unstable
  pkgs = (import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/b3582c75c7f21ce0b429898980eddbbf05c68e55.tar.gz")
    {
      crossSystem = "aarch64-unknown-linux-gnu";
    }).__splicedPackages;
in pkgs.mkShell {
  buildInputs = [ pkgs.cpuid ];
}
src/x86/cpuid.c:138:10: fatal error: cpuid.h: No such file or directory
  138 | #include <cpuid.h>

It seems to build x86 specific files https://github.com/pytorch/cpuinfo/blob/main/CMakeLists.txt

16:15:48
@rosscomputerguy:matrix.orgTristan Ross
  1. Use packages
  2. Add cmake (& optionally ninja) to packages
16:24:51
@curid:matrix.org@curid:matrix.orgI'm stupid, the cpuid package has nothing to do with cpuid.h16:37:11
@curid:matrix.org@curid:matrix.org

🤔

       > CMake Error at CMakeLists.txt:71 (MESSAGE):
       >   Unrecognized CMAKE_SYSTEM_PROCESSOR value "x86_64"

https://github.com/google/XNNPACK/blob/659147817805d17c7be2d60bd7bbca7e780f9c82/CMakeLists.txt#L71

18:30:29
10 May 2025
@curid:matrix.org@curid:matrix.orgHow can I tell mkDerivation that the CMakeLists.txt isn't in the root dir? https://github.com/google/gemmlowp/tree/master/contrib17:16:18
@curid:matrix.org@curid:matrix.orgI'd ask in the main room if I could join it17:16:23
@k900:0upti.meK900 sourceRoot 17:16:35
@k900:0upti.meK900Also invited to the main room17:16:50
11 May 2025
@curid:matrix.org@curid:matrix.org is cmake message(${CMAKE_SYSTEM_PROCESSOR}) suppose to print x86_64? 08:04:19
@curid:matrix.org@curid:matrix.org

When cross-compiling, a CMAKE_TOOLCHAIN_FILE should set the CMAKE_SYSTEM_PROCESSOR variable to match target architecture that it specifies (via CMAKE_<LANG>COMPILER and perhaps CMAKE<LANG>_COMPILER_TARGET).

Am I suppose to set it manually?

08:05:35
@curid:matrix.org@curid:matrix.orgRedacted or Malformed Event19:16:46
@curid:matrix.org@curid:matrix.orgI finally managed to get tensorflow lite to cross-compile to aarch64 by using cmake instead of bazel: https://paste.debian.net/1374172/19:17:16
@curid:matrix.org@curid:matrix.orgshould I upstream it?19:33:39

Show newer messages


Back to Room ListRoom Version: 6