Use more correct paths in interop stubs generator
* Use absolute paths to C sources and artifacts because stub generator
changes working directory when running clang.
* Do not change working directory when running without def file.
This commit is contained in:
committed by
SvyatoslavScherbina
parent
bb8f04ab87
commit
2b98f9bce6
+7
-6
@@ -354,20 +354,21 @@ private fun processLib(konanHome: String,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val workDir = defFile?.absoluteFile?.parentFile ?: File(System.getProperty("java.io.tmpdir"))
|
val workDir = defFile?.absoluteFile?.parentFile ?: File(userDir)
|
||||||
|
|
||||||
if (flavor == KotlinPlatform.JVM) {
|
if (flavor == KotlinPlatform.JVM) {
|
||||||
|
|
||||||
val outOFile = createTempFile(suffix = ".o")
|
val outOFile = createTempFile(suffix = ".o")
|
||||||
|
|
||||||
val compilerCmd = arrayOf("$llvmInstallPath/bin/$compiler", *gen.libraryForCStubs.compilerArgs.toTypedArray(),
|
val compilerCmd = arrayOf("$llvmInstallPath/bin/$compiler", *gen.libraryForCStubs.compilerArgs.toTypedArray(),
|
||||||
"-c", outCFile.path, "-o", outOFile.path)
|
"-c", outCFile.absolutePath, "-o", outOFile.absolutePath)
|
||||||
|
|
||||||
runCmd(compilerCmd, workDir, verbose)
|
runCmd(compilerCmd, workDir, verbose)
|
||||||
|
|
||||||
val outLib = nativeLibsDir + "/" + System.mapLibraryName(libName)
|
val outLib = File(nativeLibsDir, System.mapLibraryName(libName))
|
||||||
|
|
||||||
val linkerCmd = arrayOf("$llvmInstallPath/bin/$linker", *linkerOpts, outOFile.path, "-shared", "-o", outLib,
|
val linkerCmd = arrayOf("$llvmInstallPath/bin/$linker", *linkerOpts, outOFile.absolutePath, "-shared",
|
||||||
|
"-o", outLib.absolutePath,
|
||||||
"-Wl,-flat_namespace,-undefined,dynamic_lookup")
|
"-Wl,-flat_namespace,-undefined,dynamic_lookup")
|
||||||
|
|
||||||
runCmd(linkerCmd, workDir, verbose)
|
runCmd(linkerCmd, workDir, verbose)
|
||||||
@@ -375,9 +376,9 @@ private fun processLib(konanHome: String,
|
|||||||
outOFile.delete()
|
outOFile.delete()
|
||||||
} else if (flavor == KotlinPlatform.NATIVE) {
|
} else if (flavor == KotlinPlatform.NATIVE) {
|
||||||
val outBcName = libName + ".bc"
|
val outBcName = libName + ".bc"
|
||||||
val outLib = nativeLibsDir + "/" + outBcName
|
val outLib = File(nativeLibsDir, outBcName)
|
||||||
val compilerCmd = arrayOf("$llvmInstallPath/bin/$compiler", *gen.libraryForCStubs.compilerArgs.toTypedArray(),
|
val compilerCmd = arrayOf("$llvmInstallPath/bin/$compiler", *gen.libraryForCStubs.compilerArgs.toTypedArray(),
|
||||||
"-emit-llvm", "-c", outCFile.path, "-o", outLib)
|
"-emit-llvm", "-c", outCFile.absolutePath, "-o", outLib.absolutePath)
|
||||||
|
|
||||||
runCmd(compilerCmd, workDir, verbose)
|
runCmd(compilerCmd, workDir, verbose)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user