From ca2b483d822b16e384d4830e35fdc7b7386debce Mon Sep 17 00:00:00 2001 From: 92306 <923061378@qq.com> Date: Thu, 26 Sep 2024 23:33:17 +0800 Subject: [PATCH] build: hardcode `gcc` and `g++` paths for Android on Linux x86 --- android_configure.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/android_configure.py b/android_configure.py index 5cea0393f48a76..bac94087f0643e 100644 --- a/android_configure.py +++ b/android_configure.py @@ -1,6 +1,7 @@ import platform import sys import os +import shutil # TODO: In next version, it will be a JSON file listing all the patches, and then it will iterate through to apply them. def patch_android(): @@ -61,6 +62,9 @@ def patch_android(): elif platform.system() == "Linux": host_os = "linux" toolchain_path = android_ndk_path + "/toolchains/llvm/prebuilt/linux-x86_64" + if platform.machine() in {"x86_64", "x86"}: + os.environ['CC_host'] = shutil.which('gcc').strip() + os.environ['CXX_host'] = shutil.which('g++').strip() os.environ['PATH'] += os.pathsep + toolchain_path + "/bin" os.environ['CC'] = toolchain_path + "/bin/" + TOOLCHAIN_PREFIX + android_sdk_version + "-" + "clang"