-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Compile error for AES-NI with MSVC on ARM32 (UWP), AES-NI intrinsics are only on x86 and x64 #8168
Comments
This may be the same issue as in #7704 (however we should keep this issue open as it adds more detail) |
My above patch seems to work for Godot on UWP, I'll submit a PR for discussion. |
Actually, I checked the state in the That seems like the better option instead of an ad hoc patch like I suggested, so Edit: Ouch that PR is big, I guess not all of it is relevant for 2.28. @yuhaoth might have a clearer overview of what's needed exactly. |
Indeed, #7384 is a new feature, so won't be back-ported. |
Indeed, it used to be the case that enabling Your proposed fix looks good but incomplete: we're only activating the assembly implementation on x86_64 (not x86_32 because it would need different assembly code), so we should do the same (plus we might as well allow x86_32) for intrinsics. So the next block with |
I've raised a PR(#8209) to fix the issue. |
I have checked that on
It seems like some |
Resolved by #8209 |
Summary
Since upgrading to 2.28.3 (from 2.28.0), Godot 3.x builds for UWP fail for the ARM32 target:
library/aesni.c
includesimmintrin.h
inconditionally on_MSC_VER
, and MSVC 14 / VS 2017 at least doesn't seem to like this on ARM.This seems consistent with the MSDN documentation for VS 2022, which lists
AESNI
intrinsics forx64-amd64
andx86
, but notARM
andARM64
:I haven't bisected nor tested latest
master
branch, but looking at the code I believe the same issue exists there too.I believe it's related to recent work on adding support for AES-NI intrinsics on MSVC, which was apparently done unconditionally in d671917 and follow-ups.
mbedtls/library/aesni.c
Lines 33 to 42 in 5859098
mbedtls/library/aesni.h
Lines 57 to 61 in 5859098
For Godot, I used this patch which works it around successfully:
While I've experienced this trying to compile for UWP ARM, it may be reproducible with "Win32" builds targeting ARM and ARM64 too.
System information
Mbed TLS version (number or commit id): 2.28.4
Operating system and version: It's complicated :) Fedora 36 container running Visual Studio 2017 / MSVC 14.16.27023 with Wine. I can't easily test different configurations, but I believe the issue is fairly explicit from the MSDN documentation.
Configuration (if not default, please attach
mbedtls_config.h
): https://github.com/godotengine/godot/blob/3.x/thirdparty/mbedtls/include/mbedtls/config.hCompiler and options (if you used a pre-built binary, please indicate how you obtained it): MSVC 14.16.27023, see log output above for options.
Additional environment information: This was seen downstream in the Godot project, which builds mbedtls from source via its own SCons buildsystem. Relevant buildsystem config: https://github.com/godotengine/godot/blob/3.x/modules/mbedtls/SCsub#L12-L107
Expected behavior
aesni.c
should compile with MSVC on ARM.Actual behavior
Fails to build from source.
Steps to reproduce
Possibly (untested), try to compile mbedtls 2.28.4 (or latest 3.x) for the UWP target, ARM arch, with recent MSVC on Windows 10 or 11.
More specific to reproduce it in Godot, it should be possible following those steps: https://docs.godotengine.org/en/3.6/development/compiling/compiling_for_uwp.html
With Godot's
3.x
branch: https://github.com/godotengine/godot/tree/3.xMy specific reproduction steps are more complex and involved Godot's build server and containers.
Additional information
Happy to make a PR if my above patch seems useful. I'm not too familiar with MSVC intrinsics so I'm not confident this is the absolute correct solution.
The text was updated successfully, but these errors were encountered: