tpwrules / nixos-apple-silicon

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

m1n1 does not compile on x86_64-linux #90

Closed RossComputerGuy closed 10 months ago

RossComputerGuy commented 11 months ago
error: builder for '/nix/store/zp848wi09j27f9z62a863ypf3sj32j2n-m1n1-1.2.9.drv' failed with exit code 2;
       last 10 log lines:
       > updateAutotoolsGnuConfigScriptsPhase
       > configuring
       > no configure script, doing nothing
       > building
       > build flags: SHELL=/nix/store/p6dlr3skfhxpyphipg2bqnj52999banh-bash-5.2-p15/bin/bash ARCH=
       >   TAG   build/build_tag.h
       >   CFG   build/build_cfg.h
       >   CC    build/adt.o
       > gcc: error: unrecognized command-line option '-mstrict-align'; did you mean '-Wstrict-aliasing'?
       > make: *** [Makefile:183: build/adt.o] Error 1
       For full logs, run 'nix log /nix/store/zp848wi09j27f9z62a863ypf3sj32j2n-m1n1-1.2.9.drv'.
tpwrules commented 11 months ago

Please specify how you are building it. Cloning this repository on the latest commit (5567b99acd07e7069fb7e074f19d5ead10409798) then running nix build .#m1n1 works fine for me on x86_64-linux.

I would expect to see ARCH=aarch64-unknown-linux-gnu- in your build flags in a cross-compilation scenario.

RossComputerGuy commented 11 months ago

https://github.com/RossComputerGuy/dotfiles/blob/master/flake.nix#L43 Added this repo as an overlay

tpwrules commented 11 months ago

It does not sound like you have cross-compilation set up properly then. Here is how it is set up in this repo: https://github.com/tpwrules/nixos-apple-silicon/blob/5567b99acd07e7069fb7e074f19d5ead10409798/flake.nix#L39-L46

You should not need to build m1n1 yourself this way unless you are planning to debug an attached Apple Silicon machine using the m1n1 hypervisor and a specially-installed machine? I don't immediately see the point of including it in a dotfiles setup like this.

RossComputerGuy commented 11 months ago

Oh ok, it almost sounded like from the docs that m1n1 is needed for setting up a device. I assume I won't have an issue building m1n1 on aarch64-linux? I might need it when building my distro and adding M-series support.

tpwrules commented 11 months ago

Not sure what you mean by "my distro", but if you want to run NixOS on Apple Silicon on a particular machine, you only need to import the Apple Silicon support module into your NixOS configuration (once the machine has been set up in the docs). You don't need to build m1n1 yourself.

I suggest going through the docs step by step, then adding the necessary bits to your personal configuration to integrate with the machine once it boots and NixOS runs okay on it.

RossComputerGuy commented 11 months ago

Not sure what you mean by "my distro",

I'm building my own distro based around NixOS but heavily modified. I'm hoping to use an M-series mac to develop the OS and compile it on it.

I suggest going through the docs step by step, then adding the necessary bits to your personal configuration to integrate with the machine once it boots and NixOS runs okay on it.

That's what I've done but atm I'm having to use idevicerestore to restore my device after accidentally typing the -o argument instead of -p with sgdisk.

tpwrules commented 10 months ago

I'm not sure there is anything actionable here for me. You can use the .nix files in this repo in your distro under the MIT license. But it sounds like there was an issue with the cross-compilation instantiation that was breaking in your particular scenario.