about summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
authorMichael Holmes <i.am@ceph3.us>2023-12-12 10:17:08 -0500
committerMichael Holmes <i.am@ceph3.us>2023-12-12 10:26:12 -0500
commite6364478be7fd717b418363a374b511ee64d439d (patch)
treec58987c1793b933e5d0a7e27ca57245dccfe2376 /pkgs/development/compilers
parent7c2ff7ad03cf6d0b7da69eb3c50130c7e50b969c (diff)
gerbil: fix soname of libgerbil on darwin
The soname/identification of libgerbil on darwin is not correctly fixed up,
resulting in any binaries linked with libgerbil to attempt to link to
libgerbil in the temporary build dir from the gerbil derivation. This
means that any compiled gerbil program won't work as the propagated soname
will result in the binary being unable to correctly link with libgerbil.

Adding an Darwin-only step to use `install_name_tool` to fix up the soname
of libgerbil fixes this issue. We're using realpath here as the qualified
path to `libgerbil` is `$out/gerbil/$version/lib/libgerbil.so` and this is
an easier way to obtain the qualified path.

Fixes NixOS/nixpkgs#272967.
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/gerbil/build.nix3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkgs/development/compilers/gerbil/build.nix b/pkgs/development/compilers/gerbil/build.nix
index a0922ff9ccaca..af983be968b0f 100644
--- a/pkgs/development/compilers/gerbil/build.nix
+++ b/pkgs/development/compilers/gerbil/build.nix
@@ -106,6 +106,9 @@ stdenv.mkDerivation rec {
     ./install.sh
     (cd $out/bin ; ln -s ../gerbil/bin/* .)
     runHook postInstall
+  '' + lib.optionalString stdenv.isDarwin ''
+    libgerbil="$(realpath "$out/gerbil/lib/libgerbil.so")"
+    install_name_tool -id "$libgerbil" "$libgerbil"
   '';
 
   dontStrip = true;