!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

581 Members
129 Servers

Load older messages


SenderMessageTime
14 Feb 2025
@rosssmyth:matrix.org@rosssmyth:matrix.org

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.org@rosssmyth:matrix.org *

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.org@rosssmyth:matrix.orgYeah 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
@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:11
@artturin:matrix.orgArtturinShould work if the gcc flags aren't really needed19:08:06
@artturin:matrix.orgArtturin* Should work if the gcc build flags aren't really needed19:08:51
@rosssmyth:matrix.org@rosssmyth:matrix.org If I put that in my default.nix it results in an infinite recursion. My plan with this is to be able to build for both the armv6m target and my x86 host as I have tests that meson runs as well. I am currently using the arm-embedded-gcc packages in a noCC derivation. 19:17:36
@artturin:matrix.orgArtturin Change the variable name or put it in the callPackage overrides 19:18:36
@artturin:matrix.orgArtturin callPackage ./file.nix { <here> 19:18:47
@artturin:matrix.orgArtturin * callPackage ./file.nix { <here> } 19:18:49
@rosssmyth:matrix.org@rosssmyth:matrix.org

It still errors with infinite recursion. I have it setup as

highPower = with armPkgs;
  callPackage ./default.nix {
    stdenv = with pkgs;
      overrideCC stdenv (buildPackages.wrapCC (stdenv.cc
        // {
          stdenv.cc.targetPlatform =
            stdenv.cc.targetPlatform
            // {
              gcc =
                stdenv.cc.targetPlatform.gcc
                // {
                  arch = "arv6m";
                  cpu = "cortex-m0";
                  thumb = true;
                };
            };
        }));
  };
20:04:05
@rosssmyth:matrix.org@rosssmyth:matrix.orgoh wait20:04:14
@rosssmyth:matrix.org@rosssmyth:matrix.orgI think I see the error20:04:26
@rosssmyth:matrix.org@rosssmyth:matrix.org *

It still errors with infinite recursion. I have it setup as

highPower = with armPkgs;
  callPackage ./default.nix {
    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;
                };
            };
        }));
  };
20:05:06
@rosssmyth:matrix.org@rosssmyth:matrix.orgNo, I don't20:06:35
@artturin:matrix.orgArtturinLook through the trace20:17:09
@alexfmpe:matrix.orgalexfmpe
In reply to @emilazy:matrix.org
fwiw still personally happy to mentor bringing iOS support up to date in line with my previous statements about how it should work :P
I remember, it's just taking longer than I expected to get through pkgsCross.ghcjs so not enough budget yet for iOS
20:26:24
@alexfmpe:matrix.orgalexfmpeThere's also the, heh, cross cutting concern of template haskell20:27:09
@rosssmyth:matrix.org@rosssmyth:matrix.orgThat still ends up building it in ARM mode. Oh well.20:44:36
@lucassong:matrix.orglucassong joined the room.20:53:29
@lucassong:matrix.orglucassonghello20:53:47
15 Feb 2025
@alexfmpe:matrix.orgalexfmpe hmm the types.h errors are gone in staging-next, someone must have fixed something in between 00:45:47
@alexfmpe:matrix.orgalexfmpe though android-ndk-toolchain fails from the recent noBrokenSymlinks 00:46:23
@alexfmpe:matrix.orgalexfmpe * though android-ndk-toolchain still fails from the recent noBrokenSymlinks 00:57:01

Show newer messages


Back to Room ListRoom Version: 6