[Haskell-cafe] Fun with Cabal on Windows! [Stream fusion for Hackage]

Andrew Coppin andrewcoppin at btinternet.com
Mon Nov 19 15:29:18 EST 2007


Don Stewart wrote:
> Just a quick announce: the stream fusion library for lists, 
> that Duncan Coutts, Roman Leshchinskiy and I worked on earlier this year
> is now available on Hackage as a standalone package:
>
>     http://hackage.haskell.org/cgi-bin/hackage-scripts/package/stream-fusion-0.1.1
>
> As described in the recent paper:
>
>     "Stream Fusion: From Lists to Streams to Nothing at All"
>     Duncan Coutts, Roman Leshchinskiy and Don Stewart. ICFP 2007
>
> This is a drop-in replacement for Data.List.
>   

Well, I just tried to install this, and as per usual, Cabal has having 
none of it.

C:\fusion\> runhaskell Setup configure
Configuring stream-fusion-0.1.1...
Setup: ld is required but it could not be found.

Well, no, this is Windoze, we don't have ld here...

On the other hand... hold on, doesn't GHC use GCC and ld?

On closer inspection, it seems that there *is* an LD.EXE on my 
harddrive. Cabal is simply failing to find it. Great.

It turns out, the standard GHC installer automatically adds 
C:\ghc\ghc-6.8.1.\bin to the search path. This contains GHC.EXE (and 
other things), but LD.EXE and friends aren't in there. Those are found 
in C:\ghc\ghc-6.8.1\gcc-lib. If you temporarily add *that* to your path...

C:\fusion\> set PATH=%PATH%;C:\ghc\ghc-6.8.1\gcc-lib
C:\fusion\> runhaskell Setup configure
Configuring stream-fusion-0.1.1...

C:\fusion\> runhaskell Setup build
Preprocessing library stream-fusion-0.1.1...
Building stream-fusion-0.1.1...
[1 of 3] Compiling Data.Stream      ( Data/Stream.hs, 
dist\build/Data/Stream.o )


Data/Stream.hs:585:4:
    Warning: Pattern match(es) are non-exhaustive
             In the definition of `next':
                 Patterns not matched: (_ :!: (Just (L _))) :!: S2
[2 of 3] Compiling Data.List.Stream ( Data/List/Stream.hs, 
dist\build/Data/List/Stream.o )
[3 of 3] Compiling Control.Monad.Stream ( Control/Monad/Stream.hs, 
dist\build/Control/Monad/Stream.o )
C:\ghc\ghc-6.8.1\bin\ar.exe: creating dist\build\libHSstream-fusion-0.1.1.a

C:\fusion\> runhaskell Cabal install
Installing: C:\Program Files\Haskell\stream-fusion-0.1.1\ghc-6.8.1
Registering stream-fusion-0.1.1...
Reading package info from "dist\\installed-pkg-config" ... done.
Saving old package config file... done.
Writing new package config file... done.

OH...MY...GOD... I just successfully installed my first *ever* Cabal 
package! o_O

[I haven't tried to compile anything using it yet. But ghc-pkg seems to 
report that it's all in there just fine...]

I'm posting this information just in case any other poor soul on Windows 
wants to try to install stuff with Cabal. It seems that if you simply 
install GHC, it installs Cabal too, and adds GHC to your searchpath, and 
yet Cabal won't find ld out of the box. (Surely that can't be correct?) 
However, just by temporarily altering the search path (you don't even 
have to do it permanently) you can fix it. At least, for this particular 
package it fixes it...

PS. Somebody suggested configure --with-ld=PATH. This didn't work at all...



More information about the Haskell-Cafe mailing list