[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'

未关闭
#2,263 1 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@Sharjeel-Khan 已经在做这个了。

开始于 2026年11月2日。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
android, cmake
领域
build-system

调研方向

Start by reproducing the reported target mismatch with the Android NDK CMake toolchain and clang-scan-deps, comparing the injected aarch64-none-linux-android target with the user-supplied aarch64-linux-android21 target. The report does not identify a source file or test, so first locate how the toolchain passes target flags and how dependency scanning consumes them. Done means the supported NDK builds successfully in this setup without the PCH target error.

由索引模型根据 Issue 内容生成。

描述

bug
Description

Android NDK Toolchain cmake has set:

set(ANDROID_LLVM_TRIPLE aarch64-none-linux-android)
set(ANDROID_LLVM_TRIPLE x86_64-none-linux-android)

I don't known why use -none- rather than -unknown-

CMake will automatically inject the --taregt=$ANDROID_LLVM_TRIPLE parameter to clang.

If user also pass --taregt=aarch64-linux-android21 and use with clang-scan-deps, it will report this error.

clang treat --taregt=aarch64-linux-android21 as --taregt=aarch64-unknown-linux-android21 rather than --taregt=aarch64-none-linux-android21

I am using a supported NDK
  • I have checked and the NDK I'm using is currently supported
Affected versions

r27, r29, r28, r30

主要语言
没有语言数据
星标
2.3k
派生
311
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

android/ndk 的其他 Issue

查看 android/ndk 的全部 Issue

相似的 Issue

更多 Build System Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。