-
Notifications
You must be signed in to change notification settings - Fork 263
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
ASM files broken with legacy CMake toolchain file and CMake 3.22.1 #1623
Comments
I don't think this needs to block a new CMake release? By default, CMake 3.22.1 would use the new toolchain file, which isn't affected. I'm not sure how hard it is to fix CMake's version detection. |
I filed https://gitlab.kitware.com/cmake/cmake/-/issues/22995 for this issue. |
It's not actually in the legacy toolchain (file, maybe you meant the CMake side of the legacy toolchain workflow).
+1. |
There's too much indirection. There are two flags:
If Only the legacy toolchain sets the I think we can remove these lines, which fixes newer NDKs. It doesn't fix the older NDK + newest CMake + legacy-toolchain-file combo, but that's presumably rare. The NDK defaults to the non-legacy toolchain, so the user must override it with
It occurred to me that I can't update the cmake prebuilt until fixing (some part of) this issue, so I think I actually want to fix it first. |
https://android.googlesource.com/platform/ndk/+/refs/heads/main/tests/build/build-assembly-file/ covers building asm from CMake in that configuration, and it's passing. Seems this is no longer an issue. |
We saw a bug like this recently and fixed it (https://android-review.googlesource.com/c/platform/ndk/+/1894539/), but it's broken again. This issue affects the legacy CMake toolchain file when using CMake 3.22.1 (presumably 3.19 and up are broken):
The legacy toolchain file is used by default for CMake versions less than 3.21.
CMake's Clang compiler version detection is broken for ASM mode, which seems like an upstream bug:
It only affects the legacy toolchain because only the legacy toolchain sets the CMAKE_${LANG}_COMPILER_EXTERNAL_TOOLCHAIN flags, which result in passing -gcc-toolchain/--gcc-toolchain=. The new toolchain file doesn't.
I don't know what this flag is used for, and maybe it's not actually needed anymore, so we can remove it from the legacy toolchain.
Updating CMake from 3.18.1 to 3.22.1 breaks the legacy toolchain file, because it disables the recent NDK fix, which only applies to versions older than CMake 3.19:
https://android.googlesource.com/platform/ndk/+/refs/tags/ndk-r24-beta1/build/cmake/android-legacy.toolchain.cmake#414
A fix is to enable that compiler ID override for all versions of CMake.
It would appear that there's a range of CMake versions where ASM files currently can't be compiled, starting with 3.19 and ending with 3.20.x. 3.21 and newer use the non-legacy toolchain file and so aren't affected.
The text was updated successfully, but these errors were encountered: