link problem under macosx

John Lato jwlato at
Tue Nov 2 13:20:01 EDT 2010

> From: Christian Maeder <Christian.Maeder at>
> Am 02.11.2010 11:48, schrieb Christian Maeder:
> > Hi,
> >
> > after installing
> >
> > and various more libraries using cabal, we get the following linker
> > error below.
> >
> > A simple hello program compiles and links fine and uses
> > /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version
> > 7.0.0) as shown by "otool -L".
> >
> > Does someone have an explanation or solution?
> adding "-L/usr/lib" as first argument to ghc solved the problem.
> Another cabal-package (gtk and friends) used /opt/local/lib under
> library-dirs:.
> Are there better workarounds?

Judging from the /opt/*, it looks like you're using macports for gtk.  The
libiconv provided by macports is incompatible with the system libiconv, and
trying to mix the two is a doomed effort.

If you're using a gtk2hs from macports (or gtk+ from macports) it will link
to /opt/local/lib/libiconv, but HP and ghc core libraries will link to
/usr/lib/libiconv.  This means that various haskell packages will be
entirely incompatible with each other, and problems will manifest as these
linker errors.

Since Apple seems disinclined to fix the system's libiconv, and macports
projects refuse to use it, the only real solution is to use either HP
without macports or the macports GHC without HP.  Personally I chose to use
the HP and built gtk+ using , which is
moderately painful but has been stable once it's built.

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Glasgow-haskell-users mailing list