On 6 January 2011 16:11, Joe Bruce <bruce.jo...@gmail.com> wrote:
> Thanks, Max.  I had seen that thread already, but I don't understand how it
> helps me.  I'm on a x64 mac and I have both an i386 and x64 version of
> readline installed (via macports install readline +universal).  Perhaps
> cabal is choosing the wrong one.  How do I find out?  How do I tell it which
> to use?  And which do I want it to use?

Well, MacPorts +universal should install fat binaries that include
both x86 and x64. On my machine:

"""
mbolingbr...@c089 ~
$ file /opt/local/lib/libreadline.5.0.dylib
/opt/local/lib/libreadline.5.0.dylib: Mach-O universal binary with 2
architectures
/opt/local/lib/libreadline.5.0.dylib (for architecture i386):   Mach-O
dynamically linked shared library i386
/opt/local/lib/libreadline.5.0.dylib (for architecture x86_64): Mach-O
64-bit dynamically linked shared library x86_64

mbolingbr...@c089 ~
$ file /opt/local/lib/libreadline.a
/opt/local/lib/libreadline.a: Mach-O universal binary with 2 architectures
/opt/local/lib/libreadline.a (for architecture i386):   current ar
archive random library
/opt/local/lib/libreadline.a (for architecture x86_64): current ar
archive random library
"""

GHC on OS X builds 32 bit executables, so you need to link against
these binaries. Long story short:

$ cabal unpack readline

Then edit readline.cabal to add this line to the end:

  extra-lib-dirs:  /opt/local/lib

(You must indent it to put it in the "library" section). Finally:

$ sudo cabal install
--configure-option=--with-readline-includes="/opt/local/include"
--configure-option=--with-readline-libraries="/opt/local/lib"

It will now work. You can try it by opening ghci and typing:

System.Console.Readline.readline "Command Me> "

An alternative to editing the cabal file would have been to link to
the Macports fat-binary libreadline.a from the OS X system library
directories (maybe /usr/lib or /usr/local/lib).

Cheers,
Max

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to