-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uname -m reports x86_64 on arm64 systems #171
Comments
There is no native MSYS2 runtime that supports ARM64. What you are running is an x86_64 MSYS2 runtime, running in emulation mode. Therefore the |
That is indeed what I meant by "Because msys2-runtime is built only as x86_64 and runs on arm64 under emulation". It's undesirable behavior, specifically in the |
Lying about the CPU architecture the MSYS2 runtime is running on might help some use cases, but totally break others. That's worse than undesirable, that would be willful. The proper solution is to build an ARM64 version of the MSYS2 runtime. The problem with that is that it is currently impossible, and it will take years to finish that work. BTW for many scenarios, looking at |
Corss-posting to keep the information at one place, I stand by what I have previously said on Discord:
|
I agree that |
I'm glad we all agree that an arm64 native build of msys2-runtime would resolve this issue.
What @Blackhex said in Discord implied this was closer to happening. You appear to share an employer; maybe you could share notes? Regarding alternatives, I'll just say that if binaries compiled in a |
So. Are you working on this? Maybe you did not hear me when I essentially explained that you're asking for the moon here.
Work is currently underway to support Windows/ARM64 in binutils. That is a huge undertaking. And it is only the first step of many to get And now that you have a glimpse of what you were actually asking for (an effort easily keeping a decently-sized team of top notch experts busy for years), maybe you can agree with the rest of us that looking at |
I only filed this issue because @lazka specifically requested that I do so. If you have further questions, take them to him. |
Let's try this one more time. For the use case of someone compiling software for arm64 on an arm64 machine using msys2 and clangarm64 packages, the (virtualized) environment that uname runs in is not paramount. The true architecture of the host CPU is a more relevant than the architecture that uname was compiled for. I understand that there must be other use cases for which that information is still relevant, which is why I haven't argued it should simply always report the native machine returned by IsWow64Process2. I understand that having an arm64 msys runtime would mostly make this go away, but that's actually not my preferred solution because of the work involved and because, again, the arch that the runtime was compiled for is really not relevant to my use case. Far from insisting or demanding that this work be done, I was simply acknowledging that this work would have the side effect of alleviating the issue. I do not prefer the solution of asking every individual project to update their makefiles to check MSYSTEM because it fails the test of allowing msys2 to function as drop-in replacement for compiling in a Unix-like environment. Some project maintainers outright resent having to put checks in their build systems that are Windows-specific. I'm sure you are all well aware of this, however, which is why I didn't think it was necessary for me to spell it out. If having the behavior of uname depend on MSYSTEM and report aarch64 in the clangarm64 environment (which was, again, lazka's suggestion and not my own) was viewed as acceptable, I wouldn't mind putting forth a PR. But the reaction to that seems to have been quite negative, and since nobody else is offering suggestions, it's not clear what else I can do to help. |
I've only every have seen uname being used in a build context, which in the clangarm64 case will always mean mingw builds since we don't support cygwin builds in those envs anyway. So such a hack seemed maybe worth it to me, but I might be missing something. On the other hand we've never had many problems with our existing packages being confused by uname, likely because most use a proper build system, and not just make, so I don't feel strongly about this. |
uname -m
is expected to report the host machine's CPU architecture. Some existing build scripts/makefiles depend on it to detect the host architecture (example) and often use it for the assumed target architecture.Because msys2-runtime is built only as x86_64 and runs on arm64 under emulation, uname will always report
x86_64
. Furthermore, it currently lacks the logic to report any string other than "x86_64" and " unknown":msys2-runtime/winsup/cygwin/uname.cc
Lines 66 to 74 in f992cbc
I believe
aarch64
would be the appropriate string to use on Win/arm64 systems for consistency with other OSes.The text was updated successfully, but these errors were encountered: