ocaml / opam

opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.
https://opam.ocaml.org
Other
1.21k stars 348 forks source link

`opam var arch` reports kernel rather than user arch on Raspberry Pi OS #5949

Open dra27 opened 1 month ago

dra27 commented 1 month ago

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?

dra27 commented 1 month ago

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.