Cannot link to readline

Yitzchak Gale gale at sefer.org
Thu Mar 6 04:33:04 EST 2008


I wrote:
>> On Mac OS X 10.4, I can't link programs that use readline
>> unless I explicitly specify the GNUreadline framework
>> on the ghc command line...

That was for GHC 6.6.1, the current binary release version for
my platform.

Judah Jacobson wrote:
> The readline package was changed in 6.8 to link with the
> framework automatically...
> you can just download version 1.0.1

Well, I just finished compiling 6.8.2 using MacPorts (thanks for
that port!). There I have the opposite problem with linking -
some symbols are doubly defined. Again, the problem
goes away when I specify -framework GNUreadline on the
ghc command line:

$ ghc --make  fooText.hs
 [4 of 5] Compiling FooText         ( FooText.hs, FooText.o )
 [5 of 5] Compiling Main             ( fooText.hs, fooText.o )
 Linking fooText ...
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning multiple
definitions of symbol _BC
/opt/local/lib/libreadline.dylib(terminal.so) definition of _BC
/opt/local/lib/libncurses.dylib(lib_termcap.o) definition of _BC
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning multiple
definitions of symbol _UP
/opt/local/lib/libreadline.dylib(terminal.so) definition of _UP
/opt/local/lib/libncurses.dylib(lib_termcap.o) definition of _UP
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning multiple
definitions of symbol _PC
/opt/local/lib/libreadline.dylib(terminal.so) definition of _PC
/opt/local/lib/libncurses.dylib(lib_tputs.o) definition of _PC
$ ghc --make -framework GNUreadline fooText.hs
 Linking fooText ...
$

Here are the package desciption and otool for that build:

a$ ghc-pkg describe readline
name: readline
version: 1.0.1.0
license: GPL
copyright:
maintainer: libraries at haskell.org
stability:
homepage:
package-url:
description: More information on readline can be found at
             <http://www.gnu.org/directory/readline.html>.
category:
author:
exposed: True
exposed-modules: System.Console.Readline
                 System.Console.SimpleLineEditor
hidden-modules:
import-dirs: /opt/local/lib/ghc-6.8.2/lib/readline-1.0.1.0
library-dirs: /opt/local/lib/ghc-6.8.2/lib/readline-1.0.1.0
hs-libraries: HSreadline-1.0.1.0
extra-libraries: readline ncurses
extra-ghci-libraries:
include-dirs: /opt/local/lib/ghc-6.8.2/lib/readline-1.0.1.0/include
includes: HsReadline.h
depends: base-3.0.1.0 process-1.0.0.0
hugs-options:
cc-options: -I/opt/local/include
ld-options: -L/opt/local/lib
framework-dirs:
frameworks:
haddock-interfaces: /opt/local/share/doc/ghc/libraries/readline/readline.haddock
haddock-html: /opt/local/share/doc/ghc/libraries/readline
$ otool -L /opt/local/lib/ghc-6.8.2/ghc-6.8.2
/opt/local/lib/ghc-6.8.2/ghc-6.8.2:
        /opt/local/lib/libreadline.5.2.dylib (compatibility version
5.0.0, current version 5.2.0)
        /opt/local/lib/libncurses.5.dylib (compatibility version
5.0.0, current version 5.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
current version 88.3.9)
        /opt/local/lib/libgmp.3.dylib (compatibility version 8.0.0,
current version 8.2.0)


More information about the Libraries mailing list