Give the DLL loader awareness of rpaths
This is nix-related. I'm trying to build with the nix version of libiconv instead of system libiconv, and to facilitate this I'm running package builds in a sandbox.
If I try to compile a module using TemplateHaskell, say
module Main where main :: IO () main = putStrLn $([|"Hello, world!"|])
I get this from ghc --make:
[1 of 1] Compiling Main ( main.hs, main.o ) Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... <command line>: can't load .so/.DLL for: libiconv.dylib (dlopen(libiconv.dylib, 9): no suitable image found. Did find:
/usr/lib/libiconv.dylib: stat() failed with errno=1)
When of course I'd rather it just try to dlopen /nix/store/lsvxsyw9w17d2rix740akjxyxcacgi3k-libiconv-41/lib/libiconv.dylib, the one it was built with.