From a32ffdc80fba9fc33250b520b8d86873d49143c9 Mon Sep 17 00:00:00 2001 From: A-nony-mous Date: Sat, 24 Oct 2026 00:22:59 +0800 Subject: [PATCH] fix(build): run the NDK clang wrapper through .cmd on Windows The extensionless wrapper is a Unix shell script; CreateProcess rejects it with error 193. llvm-strip likewise needs .exe there. --- App_Resources/Android/app.gradle | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/App_Resources/Android/app.gradle b/App_Resources/Android/app.gradle index 7baf43d7..28bf7c45 100644 --- a/App_Resources/Android/app.gradle +++ b/App_Resources/Android/app.gradle @@ -111,7 +111,12 @@ tasks.register("prepareFaceclawNativeLibs") { if (ndkRoot == null || !ndkRoot.exists()) { throw new GradleException("Android NDK is required to build libfaceclaw_lc3.so") } - def clang = file("$ndkRoot/toolchains/llvm/prebuilt/${faceclawNdkHostTag()}/bin/aarch64-linux-android24-clang") + // The NDK ships the clang driver twice: extensionless (a Unix shell script) + // and as .cmd (the CreateProcess-launchable one Windows needs). + def clangBin = "$ndkRoot/toolchains/llvm/prebuilt/${faceclawNdkHostTag()}/bin/aarch64-linux-android24-clang" + def clang = Os.isFamily(Os.FAMILY_WINDOWS) + ? file("${clangBin}.cmd") + : file(clangBin) if (!clang.exists()) { throw new GradleException("Could not find Android clang at $clang") } @@ -229,7 +234,11 @@ tasks.register("prepareFaceclawLlama") { // strip it so the APK only pays for the code (~8MB). def ndkRootForStrip = faceclawFindNdkRoot() if (ndkRootForStrip != null) { - def llvmStrip = file("$ndkRootForStrip/toolchains/llvm/prebuilt/${faceclawNdkHostTag()}/bin/llvm-strip") + // Windows wants llvm-strip.exe; the extensionless file is a Unix script. + def llvmStripBin = "$ndkRootForStrip/toolchains/llvm/prebuilt/${faceclawNdkHostTag()}/bin/llvm-strip" + def llvmStrip = Os.isFamily(Os.FAMILY_WINDOWS) && file("${llvmStripBin}.exe").exists() + ? file("${llvmStripBin}.exe") + : file(llvmStripBin) if (llvmStrip.exists()) { exec { commandLine([llvmStrip.absolutePath, "--strip-unneeded", llamaSo.absolutePath])