!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

576 Members
128 Servers

Load older messages


SenderMessageTime
11 Dec 2024
@tpool:matrix.orgtpool *

Would somebody be willing to explain how to use pkgsLLVM to me? My goal is to cross compile using clang, and I know that pkgsLLVM is key, but can't really see how to use it. Additionally, to select the CPU and FPU, do I pass config = { mcpu = "<cpu>"; mfpu = "<fpu>"; }; respectively? Sorry if this is a noob question!

Moreover, is there a way to set sysroot to a different root (i.e. copied off of the target's filesystem)?

16:43:34
@symphorien:xlumurb.eusymphorienabout sysroot, I think nixpkgs cross infra will only work with nixpkgs compilers. using stuff compiled outside nix will not fare well.17:30:08
@artturin:matrix.orgArtturin
In reply to @tpool:matrix.org

Would somebody be willing to explain how to use pkgsLLVM to me? My goal is to cross compile using clang, and I know that pkgsLLVM is key, but can't really see how to use it. Additionally, to select the CPU and FPU, do I pass config = { mcpu = "<cpu>"; mfpu = "<fpu>"; }; respectively? Sorry if this is a noob question!

Moreover, is there a way to set sysroot to a different root (i.e. copied off of the target's filesystem)?

Import nixpkgs with

crossSystem = {
  config = "something";
  useLLVM = true;
  gcc = {
    cpu = "<cpu>"
    fpu = "<fpu>";
  };
};
17:35:37
@artturin:matrix.orgArtturinhttps://github.com/NixOS/nixpkgs/blob/7ea7a19b2d52f2cbbf066d397c434f5478512352/pkgs/build-support/cc-wrapper/default.nix#L256-L27017:36:05
@artturin:matrix.orgArtturinused for clang too17:36:07
@artturin:matrix.orgArtturin
In reply to @tpool:matrix.org

Would somebody be willing to explain how to use pkgsLLVM to me? My goal is to cross compile using clang, and I know that pkgsLLVM is key, but can't really see how to use it. Additionally, to select the CPU and FPU, do I pass config = { mcpu = "<cpu>"; mfpu = "<fpu>"; }; respectively? Sorry if this is a noob question!

Moreover, is there a way to set sysroot to a different root (i.e. copied off of the target's filesystem)?

*

Import nixpkgs with

crossSystem = {
  config = "something";
  useLLVM = true;
  gcc = {
    cpu = "<cpu>";
    fpu = "<fpu>";
  };
};
17:36:47
@artturin:matrix.orgArtturinFor sysroot feel free to try it manually first and if it works manually then override the cc-wrapper to add it to one of the files in nix-support17:44:08
@artturin:matrix.orgArtturin You'll probably need to use autpatchelfHook to have a chance of it working 18:00:02
@k_t.666:matrix.orgkat ⛧ they/them joined the room.19:24:51
12 Dec 2024
@rosscomputerguy:matrix.orgTristan Ross I've been meaning to improve that with my CPU model PR that's been sitting all year lol. 07:05:49
@dont.wanna.tell:matrix.orgMartin Häcker joined the room.18:21:54
@dont.wanna.tell:matrix.orgMartin HäckerHi there, I’m trying to understand why nix has cross compilation packages cached for cross compilation from darwin-x86 but not for darwin-arm? It would seem that darwin-arm has become the much more used plattform in the last few years?18:23:04
@k900:0upti.meK900Uhh, what packages18:32:22
@k900:0upti.meK900And to what target18:32:30
@dont.wanna.tell:matrix.orgMartin Häcker

So this expression is really slow, because it tries to build all of the dependencies:

nix-build '<nixpkgs>' --arg crossSystem '(import <nixpkgs/lib>).systems.examples.raspberryPi'  -A hello &| nom
18:43:18
@dont.wanna.tell:matrix.orgMartin HäckerTo my understanding this is because the cross compilation packages are not cached (on hydra?)18:45:13
@k900:0upti.meK900You're trying to cross-compile Linux from Darwin?18:45:15
@k900:0upti.meK900Yeah not happening18:45:18
@k900:0upti.meK900Not x86, not aarch64, not anything18:45:25
@k900:0upti.meK900Run a Linux VM18:45:29
@dont.wanna.tell:matrix.orgMartin HäckerI'm currently trying to understand how I did this yesterday, but I seem to remembering that cross compiling from darwin-x86 to raspi the same way was much faster because many packages where cached.18:46:25
@k900:0upti.meK900Uhh18:46:50
@k900:0upti.meK900Definitely not the case18:46:53
@k900:0upti.meK900We barely have cross things cached for x86_64-linux to aarch64-linu18:47:04
@k900:0upti.meK900* We barely have cross things cached for x86_64-linux to aarch64-linux18:47:05
@k900:0upti.meK900And you're doing aarch64-darwin to ... armv6l?18:47:16
@dont.wanna.tell:matrix.orgMartin HäckerWell, I'm working through the nixpkgs tutorial and am currently at the cross compilation chapter. 18:47:46
@k900:0upti.meK900Uhh18:47:54
@k900:0upti.meK900We should probably have it not say that18:48:09
@k900:0upti.meK900Or tell you to cross-compile to the other variant of your existing target18:48:30

Show newer messages


Back to Room ListRoom Version: 6