Cross-compiling compile bootstrap on target instead of build

Hello,

I am trying to advance this to bootstrap properly Erlang: fix cross compilation by DianaOlympos · Pull Request #100835 · NixOS/nixpkgs · GitHub

Erlang need a bootstrap version of erlang, on the Build architecture, to properly cross compile. Hence the buildPackages.erlang_nox i add to nativeBuildInputs. The problem is that technically erlang want you to bootstrap with the same version of OTP.

I thought, good enough. I added a bootstrapped builder as can be seen here https://github.com/DianaOlympos/nixpkgs/commit/80350a1336a1ddc4da567d3b0e7a8cd1e9536078 and i inject it.

Except now, this is what i get when i try to cross compile

> nix-build -A erlang_nox --arg crossSystem '{ config = "aarch64-unknown-linux-gnu"; platform = (import <nixpkgs/lib>).systems.platforms.aarch64-multiplatform; }' ./default.nix
these derivations will be built:
  /nix/store/d7qy8qydlf6kbjm3h2cbsjs1c3in52rq-erlang-22.3-bootstrap-aarch64-unknown-linux-gnu.drv
  /nix/store/cifidx50ibxaf6flx15vi8xk021jlrz4-erlang-22.3-aarch64-unknown-linux-gnu.drv

Which is definitely not what i want. I want the bootstrapping version of OTP to be built on the Build platform, not the Host one. Anyone has an idea of how i can fix that ? i have no idea anymore.

1 Like

Bump. I have not been able to do any progress on that, i still have the same problem of a mismatch of platform. Is there anyone that could help ?