Fix uncommon link error with aarch64 curl. am: 4724720de3 am: 8e1a4e7812 am: 38eefc95e8
Change-Id: I1c193de666c88ffabe4204d86f75145fe841a476
diff --git a/ports/curl/port.kts b/ports/curl/port.kts
index 4a47446..734fa27 100644
--- a/ports/curl/port.kts
+++ b/ports/curl/port.kts
@@ -54,4 +54,17 @@
"--with-ssl=$sslPrefix"
)
}
+
+ override fun configureEnv(
+ workingDirectory: File,
+ toolchain: Toolchain
+ ): Map<String, String> = mapOf(
+ // aarch64 still defaults to bfd which transitively checks libraries.
+ // When curl is linking one of its own libraries which depends on
+ // openssl, it doesn't pass -rpath-link to be able to find the SSL
+ // libraries and fails to build because of it.
+ //
+ // TODO: Switch to lld once we're using r21.
+ "LDFLAGS" to "-fuse-ld=gold"
+ )
}
\ No newline at end of file
diff --git a/src/main/kotlin/com/android/ndkports/AutoconfPort.kt b/src/main/kotlin/com/android/ndkports/AutoconfPort.kt
index 053fe8d..1c009cb 100644
--- a/src/main/kotlin/com/android/ndkports/AutoconfPort.kt
+++ b/src/main/kotlin/com/android/ndkports/AutoconfPort.kt
@@ -24,6 +24,11 @@
toolchain: Toolchain
): List<String> = emptyList()
+ open fun configureEnv(
+ workingDirectory: File,
+ toolchain: Toolchain
+ ): Map<String, String> = emptyMap()
+
override fun configure(
toolchain: Toolchain,
sourceDirectory: File,
@@ -39,14 +44,14 @@
"--prefix=${installDirectory.absolutePath}"
) + configureArgs(workingDirectory, toolchain),
buildDirectory,
- additionalEnvironment = mapOf(
+ additionalEnvironment = mutableMapOf(
"AR" to toolchain.ar.absolutePath,
"CC" to toolchain.clang.absolutePath,
"CXX" to toolchain.clangxx.absolutePath,
"RANLIB" to toolchain.ranlib.absolutePath,
"STRIP" to toolchain.strip.absolutePath,
"PATH" to "${toolchain.binDir}:${System.getenv("PATH")}"
- )
+ ).apply { putAll(configureEnv(workingDirectory, toolchain)) }
)
}