Open matthewbauer opened 5 years ago
I marked this as stale due to inactivity. → More info
Still relevant
I marked this as stale due to inactivity. → More info
Still relevant
apple silicon M1 support only 64bit:
error: cannot set 32-bit personality: Invalid argument
extra info: https://news.ycombinator.com/item?id=27278019
This is running Linux on the M1 right?
Is there some other way we can what personality the system supports? I think we could just do personality(PER_LINUX32)
& if it succeeds enable arm32 & then do personality()
to reset it.
@matthewbauer Yep, it is nixos-vm (aarch64 native) on apple M1. There are many problems, but I will create a separate issue for it.
For example binfmt
is working bad, because CPU not support 32bit, so choosing/detecting interpreter for binfmt is wrong:
Even I fix binfmt for armv7l-linux
, but build (trying build armv7 binary) are still failing with error: cannot set 32-bit personality: Invalid argument
Example of using personality
:
Currently, when
system = x86_64-linux
, we assume that we can also setextra-platforms = i686-linux
. That is not always true. Specifically, you cannot run i686 in these two cases:CONFIG_IA32_EMULATION = n
(https://github.com/NixOS/nixpkgs/issues/51097)In these cases we should NOT set
extra-platforms = i686-linux
.We also should think about the idea of "compatible" architectures. Many architectures have backwards compatible support so that:
x86-64 only supports 32 bit modes in some cases (see above). Likewise, aarch64 can only run armv7 on processors that support 32-bit mode, which is not guaranteed. Each of these ARM architectures can run in both big endian and little endian modes. Each of these rules could automatically get added to extra-platforms as well. There are similar ideas with endianness and 64/32-bit modes in PowerPC, MIPS, SPARC, RISC-V, and WASM.
Relevant code:
https://github.com/NixOS/nix/blob/812e39313c2bcf8909b83e1e8bc548a85dcd626c/src/libstore/globals.hh#L265-L270