opam
opam copied to clipboard
`opam var arch` reports kernel rather than user arch on Raspberry Pi OS
32-bit Raspberry Pi OS runs with a 64-bit kernel and 32-bit userspace. This means that opam var arch returns arm64, but since the C compiler is 32-bit, it would be much more helpful it returned arm32 (as it does if run through linux32).
Certainly for Raspberry Pi OS, but possibly in general on Unix, we could perhaps use uname -m to determine the machine architecture, but then refine it with getconf LONG_BIT and if that returns 32 then map a few of the architectures down to smaller userspaces?
Related issue in the compiler at https://github.com/ocaml/ocaml/pull/12326 (which was solved by https://github.com/ocaml/ocaml/pull/12465).
I'm also wondering instead whether we could have a new global variable indicating the result of getconf LONG_BIT or some such to keep arch really referring to the kernel architecture, but expose the ability to know what the C compiler is likely to be doing.