[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

オープン
#2,266 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
android, cmake
領域
build-system

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

bug
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()
  1. 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-24
  2. cmake -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

主要言語
言語のデータがありません
スター
2.3k
フォーク
311
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

android/ndk のほかの issue

android/ndk の issue をすべて見る

似ている issue

Build System の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。