From 4eb1d199de0c0bb865ebe4516f6b00c76bf53c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20H=C3=A6gland?= Date: Thu, 16 Sep 2021 00:35:20 +0200 Subject: [PATCH] Add -rpath when compiling XS modules on macOS. This fixes issue #402 This change fixes issue #402 on my machine. --- lib/ExtUtils/MM_Unix.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm index ddab71e76..195f8957b 100644 --- a/lib/ExtUtils/MM_Unix.pm +++ b/lib/ExtUtils/MM_Unix.pm @@ -1049,8 +1049,8 @@ sub xs_make_dynamic_lib { $ldfrom = "-all $ldfrom -none" if $Is{OSF}; # The IRIX linker doesn't use LD_RUN_PATH - my $ldrun = $Is{IRIX} && $self->{LD_RUN_PATH} ? - qq{-rpath "$self->{LD_RUN_PATH}"} : ''; + my $ldrun = ($Is{IRIX} || $^O eq "darwin") && $self->{LD_RUN_PATH} ? + qq{-rpath "$self->{LD_RUN_PATH}"} : ''; # For example in AIX the shared objects/libraries from previous builds # linger quite a while in the shared dynalinker cache even when nobody