
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: $ 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/bin/ld: Undefined symbols: _rl_initialize _rl_unbind_key _add_history _readline collect2: ld returned 1 exit status $ ghc --make -framework GNUreadline fooText.hs Linking fooText ... $ Note that this happens for programs that explicitly use System.Console.Readline, not in general ghc use. Manuel M T Chakravarty wrote:
Did you specify -package readline?
-package readline doesn't help. It only compiles if I say -framework GNUreadline.
The readline package spec should include the framework option (if not, its a bug in the config of the readline package IMO).
OK, I'll copy this to the libraries list then. Thanks, Yitz

On Wed, Mar 5, 2008 at 11:58 PM, Yitzchak Gale
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:
Note that this happens for programs that explicitly use System.Console.Readline, not in general ghc use.
Manuel M T Chakravarty wrote:
Did you specify -package readline?
-package readline doesn't help. It only compiles if I say -framework GNUreadline.
The readline package spec should include the framework option (if not, its a bug in the config of the readline package IMO).
I agree; the framework is supposed to be linked in automatically. Yitzchak, what version of GHC are you running? Is it a development build or a release? Also, what is the output of the following commands? ghc-pkg describe readline otool -L /usr/local/lib/ghc-6.8.2/ghc-6.8.2 [modified to fit the location/version of your ghc] -Judah

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... Note that this happens for programs that explicitly use System.Console.Readline, not in general ghc use.
Manuel M T Chakravarty wrote:
The readline package spec should include the framework option (if not, its a bug in the config of the readline package IMO).
Judah Jacobson wrote:
I agree; the framework is supposed to be linked in automatically. Yitzchak, what version of GHC are you running? Is it a development build or a release?
The release version 6.6.1, via the (former) standard download link on the GHC web site.
Also, what is the output of the following commands?
Pasted below. Thanks, Yitz $ ghc-pkg describe readline name: readline version: 1.0 license: BSD3 copyright: maintainer: libraries@haskell.org stability: homepage: package-url: description: category: author: exposed: True exposed-modules: System.Console.Readline System.Console.SimpleLineEditor hidden-modules: import-dirs: /usr/local/lib/ghc-6.6.1/imports library-dirs: /usr/local/lib/ghc-6.6.1 hs-libraries: HSreadline extra-libraries: extra-ghci-libraries: include-dirs: /usr/local/lib/ghc-6.6.1/include includes: HsReadline.h depends: base-2.1.1 hugs-options: cc-options: ld-options: framework-dirs: frameworks: haddock-interfaces: /usr/local/share/ghc-6.6.1/html/libraries/readline/readline.haddock haddock-html: /usr/local/share/ghc-6.6.1/html/libraries/readline $ otool -L /usr/local/lib/ghc-6.6.1/ghc-6.6.1 /usr/local/lib/ghc-6.6.1/ghc-6.6.1: GNUreadline.framework/Versions/A/GNUreadline (compatibility version 5.0.0, current version 5.2.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.7) GMP.framework/Versions/A/GMP (compatibility version 7.0.0, current version 7.0.0)

On Thu, Mar 6, 2008 at 12:36 AM, Yitzchak Gale
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... Note that this happens for programs that explicitly use System.Console.Readline, not in general ghc use.
Manuel M T Chakravarty wrote:
The readline package spec should include the framework option (if not, its a bug in the config of the readline package IMO).
Judah Jacobson wrote:
I agree; the framework is supposed to be linked in automatically. Yitzchak, what version of GHC are you running? Is it a development build or a release?
The release version 6.6.1, via the (former) standard download link on the GHC web site.
Also, what is the output of the following commands?
$ ghc-pkg describe readline name: readline version: 1.0
Ah, OK. The readline package was changed in 6.8 to link with the framework automatically (it did not in 6.6.2 and earlier). If you don't want to update ghc, you can just download version 1.0.1 of readline from hackage and install it manually: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/readline-1.0.1.0 Hope that helps, -Judah

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@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)

I wrote:
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:
After downloading readline 1.0.1.0 from hackage and installing it to both GHC 6.6.1 (binary installation) and GHC 6.8.2 (MacPorts), the problem went away for both compilers. The GNUreadline framework is now listed in the ghc-pkg description for both of them. Kind of odd. Thanks, Yitz
participants (2)
-
Judah Jacobson
-
Yitzchak Gale