@@ -5,9 +5,9 @@ import com.google.cloud.tools.jib.api.buildplan.ImageFormat
55import com.google.cloud.tools.jib.gradle.extension.nativeimage.JibNativeImageExtension
66import common.*
77import common.Platform
8- import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
9- import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType
8+ import org.jetbrains.kotlin.gradle.plugin.mpp.*
109import org.jetbrains.kotlin.gradle.tasks.KotlinNativeLink
10+ import org.jetbrains.kotlin.konan.target.Family
1111
1212plugins {
1313 dev.suresh.plugin.kotlin.mpp
@@ -24,12 +24,13 @@ kotlin {
2424
2525 targets.withType<KotlinNativeTarget >().configureEach {
2626 binaries {
27- executable(setOf (DEBUG )) {
27+ executable(setOf (RELEASE )) {
2828 entryPoint = " main"
2929 // Fix for libcrypt.so.1 not-found error on distroless
30- if (target.targetName.startsWith(" linux" )) {
31- linkerOpts(" --as-needed" )
32- freeCompilerArgs + = " -Xoverride-konan-properties=linkerGccFlags.linux=-lgcc -lgcc_eh -lc"
30+ if (target.konanTarget.family == Family .LINUX ) {
31+ linkerOpts(" -Wl,--as-needed" , " -Wl,-Bstatic" , " -lz" , " -Wl,-Bdynamic" )
32+ // freeCompilerArgs += "-Xoverride-konan-properties=linkerGccFlags.linux=-lgcc -lgcc_eh
33+ // -lc"
3334 }
3435
3536 if (buildType == NativeBuildType .RELEASE ) {
@@ -119,7 +120,7 @@ jib {
119120sourceSets.maybeCreate(" main" )
120121
121122tasks {
122- val buildType = " Debug "
123+ val buildType = " Release "
123124 val macOsUniversalBinary by
124125 registering(Exec ::class ) {
125126 val macosX64 = named<KotlinNativeLink >(" link${buildType} ExecutableMacosX64" )
0 commit comments