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

Open
#2,263 1 comment 0 reactions 1 assignee View on GitHub

@Sharjeel-Khan is already working on this.

Since Nov 2, 2026.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
android, cmake
Domain
build-system

Research direction

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.

Written by the indexing model from the issue text.

Description

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

Dominant language
No language data
Stars
2.3k
Forks
311
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from android/ndk

All issues in android/ndk

Similar issues

More Build System issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.