From 95df6e5cb13f6a5f83bd32cb3518d8c5dfa4a30e Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 30 Jul 2024 19:17:04 -0500 Subject: [PATCH] Add a workaround for libcrypt linking issue See #54. --- build.gradle.kts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index b2843a8..4d4d486 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -72,4 +72,23 @@ kotlin { } } } + + // NB: Tell the GNU linker to only link to shared libraries as needed. + // We do this in particular to avoid libcrypt being linked into the + // executable somehow; this matters for certain distros (e.g. Manjaro + // Linux) that do not come with libcrypt out of the box. + linuxX64 { + binaries { + all { + linkerOpts += "-Wl,--as-needed" + } + } + } + linuxArm64 { + binaries { + all { + linkerOpts += "-Wl,--as-needed" + } + } + } }