!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

426 Members
96 Servers

Load older messages


SenderMessageTime
7 Dec 2024
@artturin:matrix.orgArtturin do git log -p -M --follow --stat -- lib/systems/parse.nix for how others have added them 21:21:14
@artturin:matrix.orgArtturinexample https://github.com/NixOS/nixpkgs/commit/4db467f7e921cfe26c499076ea23044bb8a60ad6#diff-f970a71ad61b6b3ee7cfb369f3de4324885ff93d8d7f6b28253b0a812c166b13R9321:21:37
9 Dec 2024
@otanaut:matrix.orgotanaut joined the room.10:53:55
@otanaut:matrix.orgotanaut Hey everyone, I am setting up a remote builder VM in my Proxmox environment. The goal is to use this builder to compile x86_64 and aarch64 binaries, as my main system is an Apple Silicon Mac. (Hey, I heard virtualization while you virtualize the virtualizer.)

The builder is up and running and doing its job. To compile aarch64 binaries, I configured boot.binfmt.emulatedSystems = [ "aarch64-linux" ] on the builder. Is there anything else I should consider or that you would recommend, as I am fairly new to the topic?

Thank you!
10:57:39
@otanaut:matrix.orgotanaut
In reply to@otanaut:matrix.org
Hey everyone, I am setting up a remote builder VM in my Proxmox environment. The goal is to use this builder to compile x86_64 and aarch64 binaries, as my main system is an Apple Silicon Mac. (Hey, I heard virtualization while you virtualize the virtualizer.)

The builder is up and running and doing its job. To compile aarch64 binaries, I configured boot.binfmt.emulatedSystems = [ "aarch64-linux" ] on the builder. Is there anything else I should consider or that you would recommend, as I am fairly new to the topic?

Thank you!
The builder is falling back to TCG to build the aarch64 binaries, not sure if that's "the best i get" or I am missing something.
10:59:10
@p14:matrix.orgp14

Artturin: I was hoping I might be able to get a libcxxClang package set by doing crossSystem = { inherit system; custom = true; } (custom = true makes buildPlatform != hostPlatform) and then config.replaceCrossStdenv = { buildPackages, baseStdenv }: buildPackages.libcxxStdenv;.

However this blows up deep in splicing on pkgsTargetTarget. Do you happen to know if there are any threads I can pull on here to make this work?

22:05:41
@p14:matrix.orgp14 *

Artturin: I was hoping I might be able to get a libcxxClang package set by doing crossSystem = { inherit system; custom = true; } (custom = true makes buildPlatform != hostPlatform) and then config.replaceCrossStdenv = { buildPackages, baseStdenv }: buildPackages.libcxxStdenv;.

However this blows up deep in splicing on pkgsTargetTarget (infinite recursion). Do you happen to know if there are any threads I can pull on here to make this work?

22:06:37
@p14:matrix.orgp14 *

Artturin: I was hoping I might be able to get a libcxxClang package set by doing crossSystem = { inherit system; custom = true; } (custom = true makes buildPlatform != hostPlatform) and then config.replaceCrossStdenv = { buildPackages, baseStdenv }: buildPackages.llvmPackages.libstdcxxStdenv; (or similar).

However this blows up deep in splicing on pkgsTargetTarget (infinite recursion). Do you happen to know if there are any threads I can pull on here to make this work?

22:13:42
@p14:matrix.orgp14Clearly there is pkgsLLVM, but I'm thinking about pkgsClang (but with libstd++) here.22:13:50
@p14:matrix.orgp14 Ah, apologies for the unnecesssary ping; I think if you make a stdenv with buildPackages.overrideCC baseStdenv buildPackages.llvmPackages.libstdcxxClang, it actually works! My error was to try and use libcxxClang, this one goes into infinite recursion, but a least that can be fixed by doing crossSystem = { useLLVM = true; }. 22:17:53
11 Dec 2024
@marijan:matrix.orgmarijan changed their profile picture.14:20:37
@tpool:matrix.orgtpool joined the room.16:37:58
@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! 16:40:15
@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 OS)?

16:42:47
@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

Show newer messages


Back to Room ListRoom Version: 6