[Haskell-cafe] Mac OS X dylib woes

John MacFarlane jgm at berkeley.edu
Tue Sep 16 19:49:28 EDT 2008

I'm hoping some Haskell developers who use Macs can help me with this
one. I can install pcre-light just fine using cabal install. But when I
try to use it, I get this error:

GHCi, version 6.8.2: http://www.haskell.org/ghc/  :? for help
:Loading package base ... linking ... done.
Prelude> :m Text.Regex.PCRE.Light.Char8
Prelude Text.Regex.PCRE.Light.Char8> compile "h." []
Loading package array- ... linking ... done.
Loading package bytestring- ... linking ... done.
Loading package pcre-light-0.3.1 ... can't load .so/.DLL for: pcre (dlopen(libpcre.dylib, 10): image not found)

OK, so it can't find the pcre library (which is in /opt/local/lib).
I can fix that:

export DYLD_LIBRARY_PATH=/opt/local/lib

Now it works. But other things are broken! For example, I can't run vim,
which looks for a library called libJPEG.dylib and now finds libjpeg.dylib
in /opt/local/lib (case-insensitive file system!).

The apple website recommends against setting DYLD_LIBRARY_PATH.
Instead, they say, the paths to the libraries should be hard-coded into
the binary:

I'm sure others have had the same problem.  What's the solution?


More information about the Haskell-Cafe mailing list