Skip to content
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] From Cmake-3.31.0 some warnings " (cmake_minimum_required)" #2100

Open
rumas84 opened this issue Nov 8, 2024 · 9 comments
Open

[BUG] From Cmake-3.31.0 some warnings " (cmake_minimum_required)" #2100

rumas84 opened this issue Nov 8, 2024 · 9 comments

Comments

@rumas84
Copy link

rumas84 commented Nov 8, 2024

Description

CMake Deprecation Warning at /opt/ninja-build2+/sources/android-ndk-r27b/build/cmake/android.toolchain.cmake:35 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
  /usr/share/cmake-3.31/Modules/CMakeDetermineSystem.cmake:146 (include)
  CMakeLists.txt:14 (project)


CMake Deprecation Warning at /opt/ninja-build2+/sources/android-ndk-r27b/build/cmake/android-legacy.toolchain.cmake:35 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
  /opt/ninja-build2+/sources/android-ndk-r27b/build/cmake/android.toolchain.cmake:55 (include)
  /usr/share/cmake-3.31/Modules/CMakeDetermineSystem.cmake:146 (include)
  CMakeLists.txt:14 (project)


CMake Deprecation Warning at /opt/ninja-build2+/sources/android-ndk-r27b/build/cmake/android.toolchain.cmake:35 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
  build/CMakeFiles/3.31.0/CMakeSystem.cmake:6 (include)
  CMakeLists.txt:14 (project)


-- The C compiler identification is Clang 18.0.2
CMake Deprecation Warning at /opt/ninja-build2+/sources/android-ndk-r27b/build/cmake/flags.cmake:18 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
  /usr/share/cmake-3.31/Modules/Platform/Android-Clang.cmake:23 (include)
  /usr/share/cmake-3.31/Modules/Platform/Android-Clang-C.cmake:1 (include)
  /usr/share/cmake-3.31/Modules/CMakeCInformation.cmake:48 (include)
  CMakeLists.txt:14 (project)


-- Detecting C compiler ABI info
CMake Deprecation Warning at /opt/ninja-build2+/sources/android-ndk-r27b/build/cmake/android.toolchain.cmake:35 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
  /opt/ninja-build2+/oscam-gitlab/build/CMakeFiles/3.31.0/CMakeSystem.cmake:6 (include)
  /opt/ninja-build2+/oscam-gitlab/build/CMakeFiles/CMakeScratch/TryCompile-lWzK3x/CMakeLists.txt:4 (project)


CMake Deprecation Warning at /opt/ninja-build2+/sources/android-ndk-r27b/build/cmake/android-legacy.toolchain.cmake:35 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
  /opt/ninja-build2+/sources/android-ndk-r27b/build/cmake/android.toolchain.cmake:55 (include)
  /opt/ninja-build2+/oscam-gitlab/build/CMakeFiles/3.31.0/CMakeSystem.cmake:6 (include)
  /opt/ninja-build2+/oscam-gitlab/build/CMakeFiles/CMakeScratch/TryCompile-lWzK3x/CMakeLists.txt:4 (project)


CMake Deprecation Warning at /opt/ninja-build2+/sources/android-ndk-r27b/build/cmake/flags.cmake:18 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
  /usr/share/cmake-3.31/Modules/Platform/Android-Clang.cmake:23 (include)
  /usr/share/cmake-3.31/Modules/Platform/Android-Clang-C.cmake:1 (include)
  /usr/share/cmake-3.31/Modules/CMakeCInformation.cmake:48 (include)
  /opt/ninja-build2+/oscam-gitlab/build/CMakeFiles/CMakeScratch/TryCompile-lWzK3x/CMakeLists.txt:4 (project)


-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/ninja-build2+/sources/android-ndk-r27b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- ....
...
..
.
HOSTCC  webif/pages_gen
GEN     webif/pages.c
GEN     Compressed 384952 template bytes into 156941 bytes. 228011 saved bytes (59.23%).
-- The CXX compiler identification is Clang 18.0.2
-- Detecting CXX compiler ABI info
CMake Deprecation Warning at /opt/ninja-build2+/sources/android-ndk-r27b/build/cmake/android.toolchain.cmake:35 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
  /opt/ninja-build2+/oscam-gitlab/build/CMakeFiles/3.31.0/CMakeSystem.cmake:6 (include)
  /opt/ninja-build2+/oscam-gitlab/build/CMakeFiles/CMakeScratch/TryCompile-ZwKrb9/CMakeLists.txt:4 (project)


CMake Deprecation Warning at /opt/ninja-build2+/sources/android-ndk-r27b/build/cmake/android-legacy.toolchain.cmake:35 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
  /opt/ninja-build2+/sources/android-ndk-r27b/build/cmake/android.toolchain.cmake:55 (include)
  /opt/ninja-build2+/oscam-gitlab/build/CMakeFiles/3.31.0/CMakeSystem.cmake:6 (include)
  /opt/ninja-build2+/oscam-gitlab/build/CMakeFiles/CMakeScratch/TryCompile-ZwKrb9/CMakeLists.txt:4 (project)


CMake Deprecation Warning at /opt/ninja-build2+/sources/android-ndk-r27b/build/cmake/flags.cmake:18 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
  /usr/share/cmake-3.31/Modules/Platform/Android-Clang.cmake:23 (include)
  /usr/share/cmake-3.31/Modules/Platform/Android-Clang-CXX.cmake:1 (include)
  /usr/share/cmake-3.31/Modules/CMakeCXXInformation.cmake:48 (include)
  /opt/ninja-build2+/oscam-gitlab/build/CMakeFiles/CMakeScratch/TryCompile-ZwKrb9/CMakeLists.txt:4 (project)


-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/ninja-build2+/sources/android-ndk-r27b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for math.h
CMake Deprecation Warning at /opt/ninja-build2+/sources/android-ndk-r27b/build/cmake/android.toolchain.cmake:35 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
  /opt/ninja-build2+/oscam-gitlab/build/CMakeFiles/3.31.0/CMakeSystem.cmake:6 (include)
  /opt/ninja-build2+/oscam-gitlab/build/CMakeFiles/CMakeScratch/TryCompile-8BVN7A/CMakeLists.txt:4 (project)


CMake Deprecation Warning at /opt/ninja-build2+/sources/android-ndk-r27b/build/cmake/android-legacy.toolchain.cmake:35 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
  /opt/ninja-build2+/sources/android-ndk-r27b/build/cmake/android.toolchain.cmake:55 (include)
  /opt/ninja-build2+/oscam-gitlab/build/CMakeFiles/3.31.0/CMakeSystem.cmake:6 (include)
  /opt/ninja-build2+/oscam-gitlab/build/CMakeFiles/CMakeScratch/TryCompile-8BVN7A/CMakeLists.txt:4 (project)


CMake Deprecation Warning at /opt/ninja-build2+/sources/android-ndk-r27b/build/cmake/flags.cmake:18 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
Call Stack (most recent call first):
  /usr/share/cmake-3.31/Modules/Platform/Android-Clang.cmake:23 (include)
  /usr/share/cmake-3.31/Modules/Platform/Android-Clang-C.cmake:1 (include)
  /usr/share/cmake-3.31/Modules/CMakeCInformation.cmake:48 (include)
  /opt/ninja-build2+/oscam-gitlab/build/CMakeFiles/CMakeScratch/TryCompile-8BVN7A/CMakeLists.txt:4 (project)

On my side CMakeLists.txt updated and it's ok .
cmake_minimum_required(VERSION 2.8...3.10)

Affected versions

r27, r28

Canary version

No response

Host OS

Linux

Host OS version

Ubuntu 24.04.1

Affected ABIs

armeabi-v7a

Build system

CMake

Other build system

No response

minSdkVersion

Null

Device API level

No response

@rumas84 rumas84 added the bug label Nov 8, 2024
@DanAlbert
Copy link
Member

Thanks for the heads up. Changing that is a breaking change for any of our users that are still on 3.6, which was the first version we had in the Android SDK and our metrics say is still used by a a handful of users (1.5% ish). We'll hold off on changing this until CMake decides to follow through on the removal. I don't think I've been through a CMake deprecation before so I'm not sure if they follow through on removals or if they deprecate to cover their asses in the event that they've got an engineering reason to remove a thing later.

1% of builds isn't all that many, and the number of those that are using a modern NDK is probably much lower (unfortunately I don't have those stats correlated), so fixing this probably wouldn't be too disruptive, but I'd prefer not to break anyone at all to just fix a warning.

@DanAlbert DanAlbert added this to the unplanned milestone Nov 8, 2024
@DanAlbert DanAlbert added the cmake label Nov 8, 2024
@DanAlbert DanAlbert removed this from the unplanned milestone Nov 8, 2024
@mhdfasilwyd
Copy link

This seems like an annoying issue when you have lot of useful logs along the build, found a workaround to suppress the warnings here.

set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE)

@misery
Copy link

misery commented Nov 13, 2024

Maybe you could add a "work-around" for that.

if(CMAKE_VERSION VERSION_LESS "3.31")
   cmake_minimum_required(VERSION 3.6)
else()
   cmake_minimum_required(VERSION 3.10)
endif()

A little bit strange but it should work.

Of course that would not help if you use deprecated API. But I don't think that there is any - otherwise it should be replaced soon with an IF(CMAKE_VERSION).

@DanAlbert
Copy link
Member

This seems like an annoying issue when you have lot of useful logs along the build

I agree, it's just not as annoying as your build being broken, and the only way I can fix the warning is by breaking the build for people using older versions of CMake.

Maybe you could add a "work-around" for that.

if(CMAKE_VERSION VERSION_LESS "3.31")
   cmake_minimum_required(VERSION 3.6)
else()
   cmake_minimum_required(VERSION 3.10)
endif()

A little bit strange but it should work.

Of course that would not help if you use deprecated API. But I don't think that there is any - otherwise it should be replaced soon with an IF(CMAKE_VERSION).

That would fork the behavior of the toolchain file and we'd have to test with multiple versions of CMake, which we don't currently have infrastucture for and I'd rather not add yet another dimension to our test matrix.

@jolaf
Copy link

jolaf commented Nov 21, 2024

The build would only get broken if people upgrade to a newer NDK version.

Could it be okay to ask 1% of people to either use an older version of NDK or a newer version of CMake?

@DanAlbert
Copy link
Member

Could it be okay to ask 1% of people to either use an older version of NDK or a newer version of CMake?

That is the alternative. If this warning is truly so bothersome that you want those people broken then that's what has to happen, but I'd rather not break those users to fix a thing that's just annoying.

Clearly this is going to happen eventually. Does it really have to happen now? It's just a warning.

@SmallLars
Copy link

I would prefer to happen it now. It is not a single warning. It happens a lot of times in a single build and floods the log :/

@yyjdelete
Copy link

For some unknown reason, the workaround(set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE) or cmake -Wno-deprecated) not work and the warns still exists if lto checks is used. Hope a better fix will be apply in newer version of NDK.
Tested with cmake 3.31.1 in Ubuntu24.04

    include(CheckIPOSupported)

    check_ipo_supported(RESULT lto_supported OUTPUT lto_error)
    if( lto_supported )
        message(STATUS "IPO / LTO enabled")
        set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
    else()
        message(STATUS "IPO / LTO not supported: <${lto_error}>")
    endif()
``

@DanAlbert
Copy link
Member

DanAlbert commented Dec 4, 2024

Alright. I'll change it in r28, but if we get a bunch of conflicting feedback from people that are broken by it (I don't expect it, but it's impossible to know, and I prefer to err on the side of not breaking people), that may need to be reverted in a minor release.

@DanAlbert DanAlbert added this to NDK r28 Dec 4, 2024
@github-project-automation github-project-automation bot moved this to Unconfirmed in NDK r28 Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Unconfirmed
Development

No branches or pull requests

7 participants