Skip to content

Commit b1b5c48

Browse files
minyungsally-sim
authored and
sally-sim
committed
Remove '-lgcc' option in ndk 23. Fixes #75.
1 parent 327a188 commit b1b5c48

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

plugin/src/main/kotlin/com/nishtahir/CargoBuildTask.kt

+4
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ open class CargoBuildTask : DefaultTask() {
167167
if (toolchain.type != ToolchainType.DESKTOP) {
168168
val toolchainDirectory = if (toolchain.type == ToolchainType.ANDROID_PREBUILT) {
169169
val ndkPath = app.ndkDirectory
170+
val ndkVersion = ndkPath.name
171+
val ndkVersionMajor = ndkVersion.split(".").first()
172+
environment("CARGO_NDK_MAJOR_VERSION", ndkVersionMajor)
173+
170174
val hostTag = if (Os.isFamily(Os.FAMILY_WINDOWS)) {
171175
if (Os.isArch("x86_64") || Os.isArch("amd64")) {
172176
"windows-x86_64"

plugin/src/main/resources/com/nishtahir/linker-wrapper.py

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
args = [os.environ['RUST_ANDROID_GRADLE_CC'], os.environ['RUST_ANDROID_GRADLE_CC_LINK_ARG']] + sys.argv[1:]
99

10+
# The gcc library is not included in ndk version 23.
11+
if 23 == int(os.environ['CARGO_NDK_MAJOR_VERSION']):
12+
args.remove("-lgcc")
13+
1014
# This only appears when the subprocess call fails, but it's helpful then.
1115
printable_cmd = ' '.join(pipes.quote(arg) for arg in args)
1216
print(printable_cmd)

0 commit comments

Comments
 (0)