Skip to content

cmd/compile: clang 18+ does not support the '-arch' switch (Android NDK binaries) #74410

Open
@tomas-mraz

Description

@tomas-mraz

Go version

go 1.24 linux amd64

Output of go env in your module/workspace:

CGO_ENABLED=1
CC="/home/tomas/Android/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang"
CXX="/home/tomas/Android/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang++"
GOOS=android
GOARCH=arm64

What did you do?

Cross-compile an Android native application on Ubuntu 24 to Android ARM64.
go build -buildmode=c-shared -o android/app/src/main/jniLibs/arm64-v8a/libvulkandraw.so

What did you see happen?

With clang 18 and 19 from android-ndk-r27c-linux.zip or newer r28b ...
a compilation ends up with this error:
clang: error: unsupported option '-arch' for target 'aarch64-linux-android24'

With clang 17 from android-ndk-r26d-linux.zip works fine, but this version is now unsupported.

Links:
https://developer.android.com/ndk/downloads
https://github.com/android/ndk/wiki/Unsupported-Downloads
https://github.com/tomas-mraz/vulkan-go_demos/tree/master/vulkandraw

What did you expect to see?

Compiled binary using clang versions 18 or 19, like with 17.

Thanks and have a nice day

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions