-
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
[FR] push/pop required policies in cmake toolchain file #2032
Comments
Because we should not be making policy decisions on your behalf. Any policies we set would change the behavior of your CMakeLists.txt. Presumably your project either doesn't have a https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html says that we could probably add something like: if (CMAKE_MINIMUM_REQUIRED LESS 3.6)
message(FATAL_ERROR "Android requires cmake_minimum_required(3.6) or greater")
endif() That's probably the best we can do. Probably a worthwhile improvement, but doesn't actually fix any bugs (and might break some builds if I'm wrong and there's actually a safe minimum between 3.3 and 3.6), so I'm not going to do that so late in the cycle in r27. We can do that for r28 though. |
(if any of that analysis is wrong, that's the best I can do without a repro case, and that's why we always ask for one, so upload one if you think I'm wrong) |
I had the same error while building
|
Okay, so it's a project that wasn't written for android, and for non-android targets it doesn't require anything newer than 2.8.12, but CMake (for good reasons) doesn't allow per-target minimum versions. That makes sense. I don't think we can do any better than a warning for this case, but definitely the warning would be useful. |
NDK27 requires CMake 3.6 or later ( android/ndk#2032 )
Should fix flakes caused by android/ndk#2032 Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
* vcpkg: bump opus to 1.5.2 Should fix flakes caused by android/ndk#2032 Signed-off-by: Vasyl Gello <vasek.gello@gmail.com> * vcpkg: actually use cached artifacts Signed-off-by: Vasyl Gello <vasek.gello@gmail.com> * Print all vcpkg log files on errors Signed-off-by: Vasyl Gello <vasek.gello@gmail.com> --------- Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
This topic comes up in vcpkg now. |
It's already on the todo list for r28, fwiw. I don't need additional convincing :)
But we know we need 3.6, and requiring 3.6 already covers that case. To do it with only policy requirements, we'd just have to list all the policies we require between the first version of CMake and 3.6, which is just a really verbose way of requiring 3.6 (for us and for users). |
I can understand that the toolchain needs at least CMake 3.6, and I wouldn't mind if it even needs a higher version. But I can't believe that it needs (almost) all of CMP001 to CMP0065. CMake 3.5 and 3.6 even didn't add new policies. |
Some of CMake's modules (e.g. CMakeFindBinUtils.cmake) simply use cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW)
...
cmake_policy(POP) |
Applying these three lines to NDK's (The remaining failures include one clang++ crash, for port gdal.) NDK 27 seems to be reaching vcpkg users in GH actions now. |
Then roll back to r26d until we can fix it. It's going to be a while still until r27b comes out. |
Ah, I didn't realize we could push/pop those. We can do that instead. Thanks! The downside is that we don't have any idea what the list of policies we need is, but we can start with 57 and continue updating the list as people uncover issues. |
Only 0057
Well, "me" can't change Github. |
Neither can I. Use a docker image so github can't change your NDK out from underneath you? |
Dear GHA users who strand here: The other NDK is still in the images, e.g. https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#android. You only need to switch some environment variables. |
Huh, we actually do attempt to deal with this. There's a My first attempt at push/pop didn't work because I didn't do it in
and
Which probably explains why the But also all this means that my concerns above aren't actually a problem in the first place so we don't even need the push/pop dance. We can just set this in the files that use |
In fact, we don't even need to mess with policies. We just needed another https://android-review.googlesource.com/c/platform/ndk/+/3211647 should fix this. The test I added now passes, anyway. |
Description
Trying to build project with new NDK we got the following for each component:
Adding
to the beginning of file ndk/27.0.11902837/build/cmake/flags.cmake solves the problem.
Why it is not set there (https://android.googlesource.com/platform/ndk/+/refs/heads/main/build/cmake/flags.cmake) by default?
P.S.: using $ANDROID_SDK/cmake/3.22.1 gives the same result
Affected versions
r27
Canary version
No response
Host OS
Linux
Host OS version
Ubuntu 20.04
Affected ABIs
arm64-v8a
Build system
CMake
Other build system
No response
minSdkVersion
26
Device API level
No response
The text was updated successfully, but these errors were encountered: