[Haskell-cafe] Haskeline, pcre-light, iconv and Cabal on OSX

Antoine Latter aslatter at gmail.com
Sun Feb 1 12:57:29 EST 2009

Funny story,

If I do the following three things, I get errors on my Intel Mac OS 10.5:

 * Build an executable with Cabal
 * Have the executable have a build-dep of pcre-light in the .cabal
 * use haskeline in the executable itself

I get crazy linker errors relating to haskeline and libiconv:

Shell output:
$ cabal clean && cabal configure && cabal build
Configuring test-0.0.0...
Preprocessing executables for test-0.0.0...
Building test-0.0.0...
[1 of 1] Compiling Main             ( test.hs, dist/build/test/test-tmp/Main.o )
Linking dist/build/test/test ...
Undefined symbols:
  "_iconv_open", referenced from:
      _s9Qa_info in libHShaskeline-
  "_iconv_close", referenced from:
      _iconv_close$non_lazy_ptr in libHShaskeline-
  "_iconv", referenced from:
      _sa0K_info in libHShaskeline-
ld: symbol(s) not found
collect2: ld returned 1 exit status

But all three above conditions need to be true - if I build using 'ghc
--make' everything works great, even if the executable imports
pcre-light and haskeline.  If I have build-deps on haskeline and
pcre-light, but don't actually import haskeline, everything also works

Here are the files I've used:

import System.Console.Haskeline

main :: IO ()
main = print "Hello!"

Name:                test
version:             0.0.0
cabal-version:       >= 1.2
build-type:          Simple

Executable test
    main-is:             test.hs
    build-depends:       base, haskeline, pcre-light>=0.3

Is there some way I need to be building haskeline on OS X to make this work?


more details:

$ cabal --version
cabal-install version 0.6.0
using version of the Cabal library

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version

pcre-light: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/pcre-light
haskeline: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/haskeline

More information about the Haskell-Cafe mailing list