!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

582 Members
127 Servers

Load older messages


SenderMessageTime
14 Feb 2025
@artturin:matrix.orgArtturin arm-embedded is arm-none-eabi 17:54:04
@artturin:matrix.orgArtturinTheres no way to know the cpu.version for arm-none-eabi 17:55:19
@artturin:matrix.orgArtturin* I think theres no way to know the cpu.version for arm-none-eabi from the name17:55:28
@artturin:matrix.orgArtturin* I think theres no way to know the cpu.version for arm-none-eabi from the triplet17:55:34
@artturin:matrix.orgArtturin The systemd conditional should check stdenv.hostPlatform.parsed.cpu ? version 17:55:55
@artturin:matrix.orgArtturin screcord -> ghostscript -> cups -> systemd 18:00:14
@artturin:matrix.orgArtturinIf srecord does not need to know targetPlatform (not compiler) then you can put it in depsBuildBuild18:00:51
@artturin:matrix.orgArtturinfrom pkgsBuildBuild18:00:57
@artturin:matrix.orgArtturin* If srecord does not need to know targetPlatform (is not a compiler) then you can put it in depsBuildBuild18:05:23
@rosssmyth:matrix.orgrosssmythThat did not change anything18:06:42
@artturin:matrix.orgArtturin
nix-repl> pkgsCross.arm-embedded.pkgsBuildBuild.srecord
«derivation /nix/store/88q413an8c5nnrhan3lqk3ggsjdwal7v-srecord-1.64.drv»
18:10:42
@rosssmyth:matrix.orgrosssmyth Oh, I did not know of pkgs.pkgsBuildBuild I thought you just meant moving it to depsBuildBuild = [pkgs.pkgsBuildHost.srecord];. That does work. Thanks. 18:12:56
@rosssmyth:matrix.orgrosssmythWhat's the difference between pkgsBuildHost and pkgsBuildBuild?18:13:34
@artturin:matrix.orgArtturinCompilers in pkgsBuildBuild compile for build platform Compilers in pkgsBuildHost compile for host platform18:14:48
@artturin:matrix.orgArtturinhttps://nixos.org/manual/nixpkgs/unstable/#var-stdenv-depsBuildBuild18:18:23
@rosssmyth:matrix.orgrosssmythCool, thanks for your help.18:18:52
@artturin:matrix.orgArtturin rosssmyth: https://github.com/NixOS/nixpkgs/pull/382110 18:23:20
@emilazy:matrix.orgemilyyou shouldn't need to explicitly specify the package set18:29:02
@emilazy:matrix.orgemily splicing ensures that depsBuildBuild = [ srecord ]; should do the right thing 18:29:11
@artturin:matrix.orgArtturin(callPackage has spliced packages so you don't have to specify the set)18:29:45
@rosssmyth:matrix.orgrosssmythOh, I see.18:33:03
@rosssmyth:matrix.orgrosssmyth

Then for the compiler itself, is there a way I can override the gcc wrapper settings? Currently it is compiling in ARM mode, while it needs to be in thumb. I once again tried a custom nixpkgs instance with

armPkgs = import nixpkgs {
  inherit system;
  crossSystem = {
    config = "arm-none-eabi";
    libc = "newlib";
    gcc = {
      arch = "armv6m";
      cpu = "cortex-m0";
    };
  };
};

But that starts recompiling all of gcc again. I see this setting
https://github.com/NixOS/nixpkgs/blob/b44babb85a1294e6b0e20ccc2c54cd0f62a84ceb/pkgs/build-support/cc-wrapper/default.nix#L248

Which is pretty much what I want.

18:49:17
@rosssmyth:matrix.orgrosssmyth *

Then for the compiler itself, is there a way I can override the gcc wrapper settings? Currently it is compiling in ARM mode, while it needs to be in thumb. I once again tried a custom nixpkgs instance with

armPkgs = import nixpkgs {
  inherit system;
  crossSystem = {
    config = "arm-none-eabi";
    libc = "newlib";
    gcc = {
      arch = "armv6m";
      cpu = "cortex-m0";
      thumb = true;
    };
  };
};

But that starts recompiling all of gcc again. I see this setting
https://github.com/NixOS/nixpkgs/blob/b44babb85a1294e6b0e20ccc2c54cd0f62a84ceb/pkgs/build-support/cc-wrapper/default.nix#L248

Which is pretty much what I want.

18:51:25
@artturin:matrix.orgArtturinthe rebuilds are because you specified arch and cpu18:56:44
@artturin:matrix.orgArtturinRedacted or Malformed Event18:56:47
@artturin:matrix.orgArtturinimage.png
Download image.png
18:56:52
@artturin:matrix.orgArtturin here's a nix-diff 18:56:57
@artturin:matrix.orgArtturin I'm not sure if gcc really needs those 2 flags because cc-wrapper has -mcpu and -march 18:59:19
@rosssmyth:matrix.orgrosssmythYeah that's what I was hoping it would set 😅. 19:00:10
@artturin:matrix.orgArtturin stdenv = overrideCC stdenv (buildPackages.wrapCC (stdenv.cc // { stdenv.cc.targetPlatform = stdenv.cc.targetPlatform // { gcc = stdenv.cc.targetPlatform.gcc // { arch = "arv6m"; cpu = "cortex-m0"; thumb = true; }; }; })) 19:07:09

Show newer messages


Back to Room ListRoom Version: 6