-
Notifications
You must be signed in to change notification settings - Fork 258
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
[BUG] ANDROID_USE_LEGACY_TOOLCHAIN_FILE not preserved correctly #1921
Comments
I don't actually understand any of this. Can you upload something that shows the problem? |
Sorry, I'd written this up in a hurry. For NDK versions where the legacy CMake toolchain isn't the default but you configure it to be used (via You can verify that by making a dummy change to error out if using the non-legacy toolchain:
Pair that with a dummy CMakeLists.txt, e.g.
Configuring with
It'll work as expected if
So primarily a theoretical concern, but it seemed like a potential oversight that was easy enough to fix. |
Ah, I see. Thanks for the detailed explanation 👍 This part of CMake is a mystery to me. |
Triaging for r27 since we're pretty far along in the r26 cycle, this isn't a regression, and (if I've understood you correctly) is asymptomatic. If someone discovers a symptom it's an easy cherry-pick into a minor release. |
Interestingly r23 tried to do this, but missed this one corner case: https://r.android.com/1810691. https://android-review.googlesource.com/c/platform/ndk/+/2924815 fixes this (though as we suspected above, the problem was asymptomatic, so it shouldn't be of any interest until we switch back to the new toolchain file by default, and we've got no plans to do so). |
Description
android.toolchain.cmake
addsANDROID_USE_LEGACY_TOOLCHAIN_FILE
toCMAKE_TRY_COMPILE_PLATFORM_VARIABLES
, so that its value is preserved intry_compile
checks. However, that preservation is done after the_USE_LEGACY_TOOLCHAIN_FILE
branch, which just does areturn()
in case you're using the legacy toolchain file, so we never actually preserveANDROID_USE_LEGACY_TOOLCHAIN_FILE
correctly.android-legacy.toolchain.cmake
has its own set ofCMAKE_TRY_COMPILE_PLATFORM_VARIABLES
, but it doesn't includeANDROID_USE_LEGACY_TOOLCHAIN_FILE
, so that doesn't work either. This is a moot point right now because we default to using the legacy toolchain file anyway, but it may become relevant in the future.Affected versions
r25, r26
Canary version
No response
Host OS
Linux, Mac, Windows
Host OS version
Any
Affected ABIs
armeabi-v7a, arm64-v8a, x86, x86_64
Build system
CMake
Other build system
No response
minSdkVersion
Any
Device API level
No response
The text was updated successfully, but these errors were encountered: