Building RUNPATH into ghc binaries for 3rd-party libraries

Albert Chin ghc-devs at
Thu Jan 19 02:53:49 UTC 2017

Hi. I am building ghc-8.0.2 on RHEL 6 and trying to get the runtime
path for 3rd-party libraries outside of the system search path
embedded into the ghc binaries. Specifically, this is for libffi and
libgmp. I am using the attached patch for this and it seems to work
for the most part. It does not work for ghc-iserv through:
  $ cd /usr/local/ghc80/lib/ghc-8.0.2/bin
  $ ldd ghc-iserv =>  (0x00007fffba3ff000) => /lib64/ (0x00000033e0e00000) => /lib64/ (0x00000033f0200000) => /lib64/ (0x00000033e0600000) => not found => /lib64/ (0x00000033e0200000) => not found => /lib64/ (0x00000033e0a00000) => /lib64/ (0x00000033dfe00000)
        /lib64/ (0x00000033dfa00000)

I presume I need to add something like the following to iserv/
  -optl-Wl,-rpath,$(FFILibDir) \
  -optl-Wl,-rpath,$(GMP_LIB_DIRS) \

albert chin (china at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ghc.patch
Type: text/x-diff
Size: 1055 bytes
Desc: not available
URL: <>

More information about the ghc-devs mailing list