[BUG] ANDROID_AR, ANDROID_RANLIB and ANDROID_STRIP are empty after a fresh build tree's first configure with ANDROID_USE_LEGACY_TOOLCHAIN_FILE=OFF
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- android, cmake
- Domain
- build-system
Research direction
Start with build/cmake/exports.cmake lines 39–41 and trace when those variables are populated during the first configure with ANDROID_USE_LEGACY_TOOLCHAIN_FILE=OFF. Use the provided reproducer and compare its first and second configure output for ANDROID_AR, ANDROID_RANLIB, and ANDROID_STRIP against the corresponding CMAKE_ values. Done when the first configure sets all three Android variables to their matching CMAKE_ tools.
Written by the indexing model from the issue text.
Description
Description
With ANDROID_USE_LEGACY_TOOLCHAIN_FILE=OFF, a fresh build tree's first configure leaves ANDROID_AR, ANDROID_RANLIB and ANDROID_STRIP empty while CMAKE_AR, CMAKE_RANLIB and CMAKE_STRIP name the NDK's tools. A second configure of the same tree sets them. The three are set by build/cmake/exports.cmake lines 39-41.
Reproducer: https://gist.github.com/YevheniiKotyrlo/ff8576a7c6d1b804b86e6e2926281af8, run as ANDROID_NDK=<the NDK> bash repro.sh with CMake and Ninja on PATH. It configures this CMakeLists.txt twice in one build tree:
cmake_minimum_required(VERSION 3.22)
project(repro LANGUAGES CXX)
foreach(tool AR RANLIB STRIP)
message(STATUS "CMAKE_${tool}=[${CMAKE_${tool}}] ANDROID_${tool}=[${ANDROID_${tool}}]")
endforeach()
cmake -S src -B build -G Ninja -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=OFF -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-24cmake -S src -B build
Expected: the first configure prints each ANDROID_ variable equal to its CMAKE_ tool, as the second does.
Seen after the first configure:
-- CMAKE_AR=[D:/android/sdk/ndk/30.0.16248370/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-ar.exe] ANDROID_AR=[]
-- CMAKE_RANLIB=[D:/android/sdk/ndk/30.0.16248370/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-ranlib.exe] ANDROID_RANLIB=[]
-- CMAKE_STRIP=[D:/android/sdk/ndk/30.0.16248370/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-strip.exe] ANDROID_STRIP=[]
and after the second:
-- CMAKE_AR=[D:/android/sdk/ndk/30.0.16248370/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-ar.exe] ANDROID_AR=[D:/android/sdk/ndk/30.0.16248370/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-ar.exe]
The run's summary:
RESULT: defect present: after the first configure ANDROID_AR=[] ANDROID_RANLIB=[] ANDROID_STRIP=[] while CMAKE_AR, CMAKE_RANLIB and CMAKE_STRIP are set; after a second configure of the same tree each matches its CMAKE_ tool
System: MINGW64_NT-10.0-26300 3.6.10-5a1665c8.x86_64 x86_64, cmake version 4.1.2, NDK Pkg.Revision = 30.0.16248370
CMake 4.5.20261119-g57c7830 prints the same. build/cmake/exports.cmake, android.toolchain.cmake and hooks/ are the same on main at c4bdd155116a9b42767534b35e93f83a91e4a06f.
I am using a supported NDK
- I have checked and the NDK I'm using is currently supported
Affected versions
r30
- Dominant language
- No language data
- Stars
- 2.3k
- Forks
- 311
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from android/ndk
-
[BUG] simpleperf associates wrong header file for lambdaPossibly taken @Jake-The-Human claimed this 24 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 40/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
[BUG] error: PCH file was compiled for the target 'aarch64-unknown-linux-android21' but the current translation unit is being compiled for target 'aarch64-none-linux-android21'Possibly taken @Sharjeel-Khan claimed this 24 days ago. Openbug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 47/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
bluesky-social/social-app#12545 ·
Maintainers usually reply within 1 day
-
refactor topic-architecture topic-ui
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
XCSoar/XCSoar#3547 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
manjaro-sway/manjaro-sway#1079 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
linux-test-project/lcov#579 ·
Maintainers usually reply within 1 day
-
compiler: the island_chunks_not_emitted report gives a count but not which islands were skippedOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100