linker error on OSX (symbol not found "_iconv")

Brandon Allbery allbery.b at gmail.com
Sun Jan 4 14:15:16 UTC 2015


On Sun, Jan 4, 2015 at 1:23 AM, Hemanth Kapila <saihemanth at 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 at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20150104/2c66e07f/attachment.html>


More information about the ghc-devs mailing list