
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-0.1.0.0 ... linking ... done. Loading package bytestring-0.9.0.1 ... 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: http://discussions.apple.com/thread.jspa?threadID=1670523&tstart=0 I'm sure others have had the same problem. What's the solution? John

I'm not getting this issue, but to fix it, given whatever you shell you use with your terminal (Terminal.app, iTerm, etc) program, just stick this into the rc file for it:
export DYLD_LIBRARY_PATH=/opt/local/lib:$DYLD_LIBRARY_PATH
For example, in this case it would exist in my ~/.zshrc - it should solve the problem for the most part. Austin

On Tue, Sep 16, 2008 at 4:49 PM, John MacFarlane
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: [snip] 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!).
I can't reproduce this, although I'm running ghc-6.8.3. It's possible something wonky happened when you previously installed pcre-light. If you type "ghc-pkg describe pcre-light", does it list "/opt/local/lib" under the "library-dirs:" field? If not, that's most likely your problem. Try unregistering the library and reinstalling with: cabal install pcre-light --extra-include-dirs=/opt/local/include --extra-lib-dirs=/opt/local/lib If that doesn't work, I think you can work around your problem with libjpeg/libJPEG by setting DYLD_FALLBACK_LIBRARY_PATH=$HOME/lib:/usr/local/lib:/lib:/usr/lib:/opt/local/lib Which should cause the linker to favor system libraries over macports' libraries. Hope that helps, -Judah

If you type "ghc-pkg describe pcre-light", does it list "/opt/local/lib" under the "library-dirs:" field? If not, that's most likely your problem. Try unregistering the library and reinstalling with:
cabal install pcre-light --extra-include-dirs=/opt/local/include --extra-lib-dirs=/opt/local/lib
That worked! Thanks. John
participants (3)
-
Austin Seipp
-
John MacFarlane
-
Judah Jacobson