!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

574 Members
127 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
7 Dec 2024
@aliarokapis:matrix.orgAlexandros Liarokapis(and ideally also set "target-cpu=cortex-m7")21:04:34
@artturin:matrix.orgArtturinThere's no support for setting target-cpu globally, if you want it in rust https://github.com/search?q=%2Ftarget-cpu%2F+lang%3Anix+NOT+is%3Afork&type=code21:08:19
@aliarokapis:matrix.orgAlexandros Liarokapis * (and ideally also set target-cpu=cortex-m7) 21:08:26
@artturin:matrix.orgArtturinSupport for setting it would be added in https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/cc-wrapper/default.nix21:09:12
@aliarokapis:matrix.orgAlexandros Liarokapisyea I guess that's to be expected, I could probably overlay it to the stdenv, I don't need deep dependency trees anyway but yes adding first-class supported would be very useful.21:09:34
@aliarokapis:matrix.orgAlexandros Liarokapisany idea about the llvm target?21:09:45
@artturin:matrix.orgArtturin just setting config should be enough 21:09:55
@aliarokapis:matrix.orgAlexandros Liarokapisdo you where the config -> llvm mapping occurs ?21:10:24
@aliarokapis:matrix.orgAlexandros Liarokapis * do you know where the config -> llvm mapping occurs ?21:10:34
@aliarokapis:matrix.orgAlexandros LiarokapisI think it was somewhere in the elaboration part, but I don't recall properly.21:11:15
@artturin:matrix.orgArtturinhttps://github.com/NixOS/nixpkgs/blob/1e56a3b5efd3c4c1451f891863cfb72e471687f7/pkgs/build-support/cc-wrapper/default.nix#L717 https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/cc-wrapper/add-clang-cc-cflags-before.sh21:17:55
@aliarokapis:matrix.orgAlexandros Liarokapisthanks a ton!21:18:16
@artturin:matrix.orgArtturin
nix-repl> import ./. { crossSystem = "thumbv7em-none-eabi" ;}
  error: Unknown CPU type: thumbv7em
21:20:22
@artturin:matrix.orgArtturinYou'll have to add the cpu type21:21:01
@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

Show newer messages


Back to Room ListRoom Version: 6