Permalink
Browse files

Fix build with non-Linux ELF OSes

We were only setting an RPATH for the RTS DLL on Linux, but as far
as I can see we should be doing it for all ELF OSes. Hopefully this
will fix the problem where the installed ghc-pkg can't find libffi.dll
on FreeBSD.
  • Loading branch information...
1 parent 0f49dd6 commit 51bf3653775ba734f7ca3de99234aba722a0c72c @igfoo igfoo committed Mar 20, 2013
Showing with 8 additions and 2 deletions.
  1. +7 −1 mk/config.mk.in
  2. +1 −1 rts/ghc.mk
View
@@ -88,7 +88,13 @@ GhcDynamic=NO
# GhcProfiled=YES means compile a profiled stage-2 compiler
GhcProfiled=NO
-# Soem platforms don't support shared libraries
+ifeq "$(findstring $(TargetOS_CPP),linux freebsd dragonfly openbsd netbsd solaris2 kfreebsdgnu haiku linux-android)" ""
+TargetElf = NO
+else
+TargetElf = YES
+endif
+
+# Some platforms don't support shared libraries
NoSharedLibsPlatformList =
ifeq "$(SOLARIS_BROKEN_SHLD)" "YES"
View
@@ -194,7 +194,7 @@ $$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/libs.depend rts/dist/b
else
ifneq "$(UseSystemLibFFI)" "YES"
LIBFFI_LIBS = -Lrts/dist/build -lffi
-ifeq "$$(TargetOS_CPP)" "linux"
+ifeq "$$(TargetElf)" "YES"
LIBFFI_LIBS += -optl-Wl,-rpath -optl-Wl,'$$$$ORIGIN'
endif

0 comments on commit 51bf365

Please sign in to comment.