The other day I was trying to install ghc-core, which requires pcre.
I had previously installed macports as this allows you to install a variety of unix applications and tools. Unfortunately, I just could not get it to work. After some fiddling with paths to try to get it to find the macports installed libraries (after having port installed pcre), I came up with the following incantation:
LIBRARY_PATH=/usr/lib:/opt/local/lib sudo cabal install --extra-lib-dirs=/opt/local/lib --extra-include-dirs=/opt/local/include ghc-core
However, this unfortunately did not work:
Linking dist/build/ghc-core/ghc-core ...
"_iconv_open", referenced from:
_hs_iconv_open in libHSbase-184.108.40.206.a(iconv.o)
"_iconv_close", referenced from:
_hs_iconv_close in libHSbase-220.127.116.11.a(iconv.o)
"_iconv", referenced from:
_hs_iconv in libHSbase-18.104.22.168.a(iconv.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
cabal: Error: some packages failed to install:
ghc-core-0.5.4 failed during the building phase.
After some Googling, I was finally able to find the issue
So I decided to completely uninstall macports.
As my friend put it on IRC:
kormat> unix on osx is a ghetto
Fortunately, there is an alternative to macports: Homebrew.
It was a breeze to install:
ruby -e "$(curl -fsSL https://gist.github.com/raw/323731/install_homebrew.rb)"
sudo brew install pcre
After that, cabal installing ghc-core worked as expected =)