On Sun, Jan 4, 2015 at 1:23 AM, Hemanth Kapila <saihemanth@gmail.com> wrote:
> ld: couldn't dlopen() /usr/lib/libdtrace.dylib: dlopen(/usr/lib/libdtrace.dylib, 1): Symbol not found: _iconv
>  Referenced from: /usr/lib/libmecabra.dylib
>  Expected in: /opt/local/lib/libiconv.2.dylib
> in /usr/lib/libmecabra.dylib for architecture x86_64
> collect2: error: ld returned 1 exit status

You are mixing Apple and MacPorts libraries. (The same will happen with Homebrew but it'll be using /usr/local/lib/libiconv.2.dylib.) Possibly you also have DYLIB_LIBRARY_PATH set, which will compound the problem; *please* do not do this. You are not on Linux where setting LD_LIBRARY_PATH is common and relatively safe, DYLIB_LIBRARY_PATH will break things.

The iconv libraries contain static data which is not compatible between versions, leading to core dumps unless something is done to force a link time error. Both MacPorts and Homebrew rename symbols in iconv to force this error.

Since you are building ghc, either you have forced it to use MacPorts libraries when it otherwise wouldn't (see above re DYLD_LIBRARY_PATH) or you at some point copied MacPorts libraries into system library paths (OS X bakes full paths into object files and dylibs. This also means such libraries cannot be used on a system without MacPorts installed without at minimum using install_name_tool to change the baked-in paths).

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net