From 8ebc0bd1ea158d8f399238aed4948c4228059a96 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Tue, 25 Apr 2017 15:38:13 +0300 Subject: [PATCH] Do not move libclang out from the clang distribution Also load libclang using the absolute path to simplify cinterop --- .../kotlin/native/interop/gen/jvm/main.kt | 3 +++ build.gradle | 22 ------------------- .../kotlin/NativeInteropPlugin.groovy | 2 -- cmd/cinterop | 1 - 4 files changed, 3 insertions(+), 25 deletions(-) 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 9be8326e3e9..e326038a1e5 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 @@ -186,6 +186,9 @@ private fun Properties.defaultCompilerOpts(target: String, dependencies: String) val sysRoot = targetSysRoot val llvmHomeDir = this.getOsSpecific("llvmHome")!! val llvmHome = "$dependencies/$llvmHomeDir" + + System.load("$llvmHome/lib/${System.mapLibraryName("clang")}") + val llvmVersion = this.getProperty("llvmVersion")!! val dependencyList = getOsSpecific("dependencies", target)?.split(' ') ?: listOf() diff --git a/build.gradle b/build.gradle index fa2fd84ce63..d271e67212f 100644 --- a/build.gradle +++ b/build.gradle @@ -215,32 +215,10 @@ task dist_compiler(type: Copy) { into('konan') } - from("$llvmDir/lib") { - into('konan/nativelib') - include '**/libclang.*' - includeEmptyDirs = false - } - // TODO: check if we use native libraries copied to dist (see above) or not. from(project(':tools:helpers').file('build/libs')) { into('konan/lib') } - - doLast { - // MacOS System Integrity Protection strips DYLD_LIBRARY_PATH from - // environment of all the binaries residing in /bin /usr/bin etc. - // That means /usr/bin/java can't use DYLD_LIBRARY_PATH to pick up - // rpath'ed libraries. - // See dyld(1), install_name_tool(1) for rpath details. - - if (isMac()) { - exec { - commandLine "install_name_tool" - args '-add_rpath', '@loader_path/', - 'dist/konan/nativelib/libclangstubs.dylib' - } - } - } } task list_dist(type: Exec) { diff --git a/buildSrc/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy b/buildSrc/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy index b6627822b3e..508b48de795 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/kotlin/NativeInteropPlugin.groovy @@ -190,8 +190,6 @@ class NamedNativeInteropConfig implements Named { ).asPath systemProperties "konan.home": project.rootProject.file("dist") environment "LIBCLANG_DISABLE_CRASH_RECOVERY": "1" - environment "DYLD_LIBRARY_PATH": "${project.llvmDir}/lib" - environment "LD_LIBRARY_PATH": "${project.llvmDir}/lib" outputs.dir generatedSrcDir outputs.dir nativeLibsDir diff --git a/cmd/cinterop b/cmd/cinterop index d0e472f7f52..b625998b7c8 100644 --- a/cmd/cinterop +++ b/cmd/cinterop @@ -86,7 +86,6 @@ CSTUBSNAME=cstubs CSTUBSNAME_ARG="-cstubsname $CSTUBSNAME" LIBCLANG_DISABLE_CRASH_RECOVERY=1 \ -LD_LIBRARY_PATH=${NATIVE_LIB} \ $JAVACMD $JAVA_OPTS ${java_args[@]} \ -cp $INTEROP_CLASSPATH \ $INTEROP_TOOL \