Using cabal readline package on i386 macbook (snow leopard)

I am trying to create and install readline on an i386 MacBook with Snow Leopard.

I have taken the following steps:

download and extract readline-6.0.tar.gz
./configure
make everything
sudo make install

I checked the examples and they seem to work (e.g. rltest supports history). This is the result of file libreadline.6.0.dylib:

libreadline.6.0.dylib: Mach-O 64-bit dynamically linked shared library x86_64

I expected this to be i386, but then if the examples work ...

then I installed the readline package from cabal with the following:

cabal install readline --reinstall --configure-option=--with-readline-includes="/usr/local/include" --configure-option=--with-readline-libraries="/usr/local/lib"

It seems to work: note that without setting the configure parameters, the command fails. I used the --reinstall flag to force reinstall, since I have already done a lot of testing.

This is the output of the bondage information:

$ cabal info readline
* readline         (library)
    Synopsis:      An interface to the GNU readline library
    Latest version available: 1.0.1.0
    Latest version installed: 1.0.1.0
    Homepage:      [ Not specified ]
    Bug reports:   [ Not specified ]
    Description:   More information on readline can be found at
                   http:\/\/www.gnu.org\/directory\/readline.html.
    License:       GPL
    Maintainer:    libraries@haskell.org
    Source repo:   [ Not specified ]
    Flags:         split-base
    Dependencies:  base >=3, process -any, base <3
    Documentation: [ Not installed ]
    Cached:        Yes
    Modules:
        System.Console.Readline
        System.Console.SimpleLineEditor

Well, it looks like I'm done. No, I do not:

GHCi, version 6.10.4: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Prelude> import System.Console.Readline
Prelude System.Console.Readline> do { readline "Prompt" }
Loading package syb ... linking ... done.
Loading package base-3.0.3.1 ... linking ... done.
Loading package filepath-1.1.0.2 ... linking ... done.
Loading package old-locale-1.0.0.1 ... linking ... done.
Loading package old-time-1.0.0.2 ... linking ... done.
Loading package unix-2.3.2.0 ... linking ... done.
Loading package directory-1.0.0.3 ... linking ... done.
Loading package process-1.0.1.1 ... linking ... done.
Loading package readline-1.0.1.0 ... linking ... <interactive>: 
/Users/macbook/.cabal/lib/readline-1.0.1.0/ghc-6.10.4/HSreadline-1.0.1.0.o: unknown symbol `_rl_basic_quote_characters'
ghc: unable to load package `readline-1.0.1.0'

Unsurprisingly, I also cannot create packages that depend on readline (e.g. JHC).

? , .

.

+3
3

, . , .

, readline.

1. file explicity told me that the library was 64 bit
2. as per rtperson advice, compiling a test example was illuminating: linking was failing for that.

:

ghc --make test_readline.hs 
Linking test_readline ...
ld: warning: in /usr/local/lib/libreadline.dylib, file is not of required architecture

, readline , . dir (make distclean), -m32 gcc:

./configure CC="gcc -m32"

( ) (sudo make install). :

~ 628 $ file /usr/local/lib/libreadline.dylib 
/usr/local/lib/libreadline.dylib: Mach-O dynamically linked shared library i386

readline , .

PS: readline-1.0.1.0 , " readline Snow Leopard with MacPorts" haskell-cafe 29 2009 .

+2

. , "" , 32-, 64- , . Apple , , :

"configure" http://developer.apple.com/library/mac/#technotes/tn2005/tn2137.html

- ppc/i386 - , "-arch i386 -arch x86_64". , ,

$file libreadline.a libreadline.a: Mach-O libreadline.a( i386): libreadline.a( x86_64):

+2

- Haskell . , , Haskell , Unices, Macs Windows - , , . ( Java...)

GTK OpenGL, , Haskell - Linux. , Ubuntu.

, , :

ghc --make TestReadline.hs

TestReadline.hs , GHCi:

main = do { readline "Prompt" }

, readline.cabal, : , -ghci- ld-options. - . Google.

, IRC Haskell .

- , Haskell IO ? , - ( 186 Real World Haskell)?

main = do 
   putStrLn "What your name?"
   inpStr <- getLine
   putStrLn $ "Welcome, " ++ inpStr ++ "!"
+1

Source: https://habr.com/ru/post/1726881/


All Articles