From b1b5c48f5ef15348c0764d1814926f79c7ab97d3 Mon Sep 17 00:00:00 2001 From: minyung Date: Wed, 23 Feb 2022 22:49:43 +0900 Subject: [PATCH] Remove '-lgcc' option in ndk 23. Fixes #75. --- plugin/src/main/kotlin/com/nishtahir/CargoBuildTask.kt | 4 ++++ plugin/src/main/resources/com/nishtahir/linker-wrapper.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/plugin/src/main/kotlin/com/nishtahir/CargoBuildTask.kt b/plugin/src/main/kotlin/com/nishtahir/CargoBuildTask.kt index 0ffe33e..d154345 100644 --- a/plugin/src/main/kotlin/com/nishtahir/CargoBuildTask.kt +++ b/plugin/src/main/kotlin/com/nishtahir/CargoBuildTask.kt @@ -167,6 +167,10 @@ open class CargoBuildTask : DefaultTask() { if (toolchain.type != ToolchainType.DESKTOP) { val toolchainDirectory = if (toolchain.type == ToolchainType.ANDROID_PREBUILT) { val ndkPath = app.ndkDirectory + val ndkVersion = ndkPath.name + val ndkVersionMajor = ndkVersion.split(".").first() + environment("CARGO_NDK_MAJOR_VERSION", ndkVersionMajor) + val hostTag = if (Os.isFamily(Os.FAMILY_WINDOWS)) { if (Os.isArch("x86_64") || Os.isArch("amd64")) { "windows-x86_64" diff --git a/plugin/src/main/resources/com/nishtahir/linker-wrapper.py b/plugin/src/main/resources/com/nishtahir/linker-wrapper.py index 488f5c7..8236696 100755 --- a/plugin/src/main/resources/com/nishtahir/linker-wrapper.py +++ b/plugin/src/main/resources/com/nishtahir/linker-wrapper.py @@ -7,6 +7,10 @@ args = [os.environ['RUST_ANDROID_GRADLE_CC'], os.environ['RUST_ANDROID_GRADLE_CC_LINK_ARG']] + sys.argv[1:] +# The gcc library is not included in ndk version 23. +if 23 == int(os.environ['CARGO_NDK_MAJOR_VERSION']): + args.remove("-lgcc") + # This only appears when the subprocess call fails, but it's helpful then. printable_cmd = ' '.join(pipes.quote(arg) for arg in args) print(printable_cmd)