tpwrules / nixos-apple-silicon

Resources to install NixOS bare metal on Apple Silicon Macs
MIT License
791 stars 82 forks source link

build the kernel with a newer gcc #11

Closed zzywysm closed 1 year ago

zzywysm commented 2 years ago

At the moment, the kernel gets built with gcc-9.3. It would be nice if the kernel were built with gcc 11 or gcc 12 instead.

tpwrules commented 2 years ago

Nixpkgs still uses gcc-9.3 for aarch64. There have been efforts to upgrade it but they didn't pan out. I'm not sufficiently competent in that area to figure out why.

Is there some benefit to using gcc 11 or 12 just for the kernel? That would require compiling another compiler.

zzywysm commented 1 year ago

Here is a proposed fix from another author, which I'm going to try out on my own Mac:

https://github.com/helsinki-systems/nixpkgs/tree/fix/aarch64-linux-gcc10

(Contrary to the branch name, it looks like this would move nixpkgs to gcc-11.x for aarch64.)

zzywysm commented 1 year ago

The root cause seems to be that this file hasn't been updated in a while:

https://github.com/NixOS/nixpkgs/commits/master/pkgs/stdenv/linux/bootstrap-files/aarch64.nix

...and it defines where the bootstrap files get copied from. Because the file is out of date, it's incompatible with newer gcc (and glibc?)

References: https://github.com/NixOS/nixpkgs/issues/36947 https://github.com/NixOS/nixpkgs/pull/36948 https://github.com/NixOS/nixpkgs/issues/40797

https://github.com/NixOS/nixpkgs/issues/108111 https://github.com/NixOS/nixpkgs/issues/108305 https://github.com/NixOS/nixpkgs/pull/187225

zzywysm commented 1 year ago

This will eventually get fixed with https://github.com/NixOS/nixpkgs/pull/209870 so closing.