[Haskell-cafe] Confused about readline/editline

Judah Jacobson judah.jacobson at gmail.com
Sun Apr 5 15:20:10 EDT 2009


On Sun, Apr 5, 2009 at 10:06 AM, Martijn van Steenbergen
<martijn at van.steenbergen.nl> wrote:
> Hello café,
>
> I'm trying to write an executable that depends on Yogurt-0.3, readline
> (indirectly) and hint. However, including hint in the build-depends field
> causes cabal to link the executable against editline instead of readline.
> Here is a small test case:
>
> File: Test.cabal
>
>> Name: Test
>> Version: 0
>>
>> Build-Type: Simple
>> Cabal-Version: >= 1.2
>>
>> Executable test
>>  Main-Is:        Test.hs
>>  Build-Depends:  base, Yogurt, hint
>>  GHC-Options:    -threaded
>
> File: Test.hs
>
>> module Main where
>>
>> import Network.Yogurt
>>
>> main:: IO ()
>> main = do
>>  connect "eclipse.cs.pdx.edu" 7680 (return ())
>
> The example doesn't use any functions from hint, but simply mentioning it in
> the cabal file causes this behaviour. What's going on? How can I fix or work
> around this?
>
> I am able to reproduce this behaviour in two configurations:
> * Leopard Intel; cabal-install version 0.6.2, using version 1.6.0.1 of the
> Cabal library; GHC 6.10.1
> * Ubuntu; cabal-install version 0.6.2, using version 1.6.0.3 of the Cabal
> library; GHC 6.10.2
>

Probably what's happening is that hint depends on the ghc package,
which links to editline in 6.10 since it includes all the code for
ghci.

I'm not sure, but there might be some order of flags or packages you
could give to Cabal which would cause it to link to readline first; I
think if gcc gets "-lreadline -ledit" in that order then it will do
what you want.  Passing "-v" or "-v3" to cabal build should let you
see what's going on.

For ghc-6.12 there's plans to prevent this issue by separating out
ghci as a separate program than the core ghc package.

-Judah


More information about the Haskell-Cafe mailing list