
From: Christian Maeder
Am 02.11.2010 11:48, schrieb Christian Maeder:
Hi,
after installing
http://lambda.galois.com/hp-tmp/2010.2.0.0/haskell-platform-2010.2.0.0.i386....
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 http://gtk-osx.sourceforge.net/ , which is moderately painful but has been stable once it's built. John

On 11/2/10 10:20 AM, John Lato wrote:
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
Not so, as mentioned you just need to make sure /usr/lib is in the link path before /opt/local/lib. Add -L/usr/lib to your build flags for ghc --make, and put: extra-lib-dirs: /usr/lib extra-lib-dirs: /opt/local/lib in that order in ~/.cabal/config for cabal build. This is a very FAQ and needs to be documented somewhere more obvious, I wonder where. cabal-install and GHC release notes ?
participants (2)
-
John Lato
-
Simon Michael