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] ANDROID_NATIVE_API_LEVEL not work for NDK 23.1 new toolchain #1610

Closed
huangqinjin opened this issue Nov 18, 2021 · 2 comments
Closed
Assignees
Labels

Comments

@huangqinjin
Copy link

Environment Details

  • NDK Version: 23.1.7779620
  • Build system: CMake 3.21 for new toolchain
  • Host OS: openSUSE tumbleweed
  • ABI: any
  • NDK API level: 25

Description

Run the following command for a minimal CMakeLists.txt:

cmake .. -DANDROID_NATIVE_API_LEVEL=25 -DCMAKE_TOOLCHAIN_FILE=/opt/android-sdk/ndk/${NDK}/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=${LEGACY}
NDK=23.1.7779620; LEGACY=OFF # --- FAIL
-- ANDROID_PLATFORM not set. Defaulting to minimum supported version 16.
-- Android: Targeting API '16' with architecture 'arm', ABI 'armeabi-v7a', and processor 'armv7-a'
NDK=23.1.7779620; LEGACY=ON # --- PASS
-- android-25 is an alias for android-24. Adjusting ANDROID_PLATFORM to match.
NDK=23.0.7599858; LEGACY=OFF # --- PASS
--         25 is an alias for         android-24.
-- Android: Targeting API '24' with architecture 'arm', ABI 'armeabi-v7a', and processor 'armv7-a'
NDK=23.0.7599858; LEGACY=ON # --- PASS
-- android-25 is an alias for android-24. Adjusting ANDROID_PLATFORM to match.
@rprichard
Copy link
Collaborator

I suspect the #1560 fix broke it:

Setting ANDROID_PLATFORM instead of ANDROID_NATIVE_API_LEVEL looks like a workaround.

Uploaded a possible fix: https://android-review.googlesource.com/c/platform/ndk/+/1897134

@DanAlbert
Copy link
Member

Should be fixed in r23 build 8486889.

MaoHan001 pushed a commit to riscv-android-src/platform-ndk that referenced this issue Jun 22, 2022
This CMake variable is recognized by the NDK's CMake toolchain file and
is an alias for ANDROID_PLATFORM (but only recognizes NN or android-NN,
not ALIAS, android-ALIAS, or latest).

The If5fbba07e1c3630ef1b2766c684288ca07294ff6 change accidentally
removed support for this variable.

Bug: android/ndk#1610
Test: checkbuild.py
Change-Id: Iadc8f886297e47cfdf2a4593ad34d38b1c4f66b6
(cherry picked from commit 1117bb7f798c91b7f92141247c4d52c15f55ae64)
Merged-In: Iadc8f886297e47cfdf2a4593ad34d38b1c4f66b6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants