[Haskell-cafe] Re: Problems with Haskell Platform

Pete Chown 1 at 234.cx
Thu Jun 3 06:07:22 EDT 2010

Ivan Lazar Miljenovic wrote:

> Pete Chown <1 at 234.cx> writes:

>> Is there a way of making Cabal install dependencies using the system
>> package manager, then?

> If you mean cabal-install, then no, there's no integration on either
> side.

That's what I thought.  As a result of this, you may find that you end 
up creating private builds of packages which are shipped by your 
distribution.  You ask Cabal to install a package, which is not shipped 
by your distribution.  Cabal will then build that package's 
dependencies, *even if* those dependencies should really be installed 
using your distribution's package manager.

> This is exactly the same with C programs.

Yes and no.  If I download the source of a C library and build my own 
shared libraries, my programs might not work on machines where the 
distribution's version of that library is in use.  The particular 
problem in the Haskell world, though, is that Cabal will create this 
situation by default.

>> (I believe current versions of ghc insist on linking entirely
>> dynamically or entirely statically.  This makes the situation worse,
>> because the lack of a shared library for X prevents the use of shared
>> libraries for anything else.)

> No, 6.12 defaults to statically but allows dynamic linking as well.

That's not what I meant.  What I meant is that you can't link against 
some Haskell libraries statically, and some dynamically.  When linking C 
this isn't a problem.  If you don't have a shared version of a 
particular library, gcc will pick the static version instead.  You can 
even choose static or dynamic for each individual library:

$ gcc foo.c -o foo -lz
$ ldd foo
         linux-gate.so.1 =>  (0x00d0b000)
         libz.so.1 => /lib/libz.so.1 (0x00dd5000)
         libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x00152000)
         /lib/ld-linux.so.2 (0x00a69000)
$ gcc foo.c -o foo -Wl,-Bstatic -lz -Wl,-Bdynamic
$ ldd foo
         linux-gate.so.1 =>  (0x00918000)
         libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x00db0000)
         /lib/ld-linux.so.2 (0x002e5000)

> Really?  For C, Gentoo ships very few which either default or have the
> option of static libraries, and I assume the same is true for binary
> distributions.

Sorry I misunderstood what you were saying; you're right.  I'm not 
familiar with Gentoo, but on Ubuntu virtually everything defaults to 
shared libraries.  You can choose static if you really want it, though, 
as in the example above.


More information about the Haskell-Cafe mailing list