diff --git a/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt b/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt index e3bb54423c0..c2d046d687e 100644 --- a/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt +++ b/Interop/StubGenerator/src/main/kotlin/org/jetbrains/kotlin/native/interop/gen/jvm/main.kt @@ -342,12 +342,14 @@ private fun selectNativeLanguage(config: Properties): Language { private fun resolveLibraries(staticLibraries: List, libraryPaths: List): List { val result = mutableListOf() staticLibraries.forEach { library -> - libraryPaths.forEach forEachPath@ { path -> - val combined = "$path/$library" - if (File(combined).exists()) { - result.add(combined) - return@forEachPath - } + + val resolution = libraryPaths.map { "$it/$library" } + .find { File(it).exists() } + + if (resolution != null) { + result.add(resolution) + } else { + error("Could not find '$library' binary in neither of $libraryPaths") } } return result @@ -426,7 +428,7 @@ private fun processLib(konanHome: String, val linker = args["-linker"]?.atMostOne() ?: config.getProperty("linker") ?: "clang" val excludedFunctions = config.getSpaceSeparated("excludedFunctions").toSet() val staticLibraries = config.getSpaceSeparated("staticLibraries") + args["-staticLibrary"].orEmpty() - val libraryPaths = args["-libraryPath"].orEmpty() + val libraryPaths = config.getSpaceSeparated("libraryPaths") + args["-libraryPath"].orEmpty() argsToCompiler ?. let { it.addAll(argsToCompiler(staticLibraries, libraryPaths)) } val fqParts = (args["-pkg"]?.atMostOne() ?: config.getProperty("package"))?.let {