[Haskell-cafe] LGPL libraries

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Mon Mar 5 19:30:35 EST 2007


On Mon, 2007-03-05 at 14:07 -0300, Alex Queiroz wrote:
> Hallo,
> 
>      Gtk2Hs and HDBC are both LGPL licensed, but aren't they always
> static linked? Is there a way to use them in closed-source programs?

Well let me put it this way: I'm not going to sue you and I doubt any of
the other contributers are either.

When we last cleaned up our license story (standardising on LGPL 2.1) we
weren't particularly aware of the static linking issue so we didn't
include a specific static linking exemption. We could do that now but
honestly it's a bit of a hassle since there are several copyright
holders. I'm hoping that the issue will be solved by ghc being able to
do produce packages as dynamic libs.

If you're really worried (but I wouldn't be) then do recall that the
static linking thing only requires that the end user be able to relink
with a different version that preserves the same ABI. So you don't have
to provide source for your closed source app, you'd just need to provide
all the .o / .a files you need to link together to produce your final
program. So it's a bit of a hassle but it does meet the requirements of
the LGPL and allows a closed source app.

So, concretely you'd do something like: ghc --make to build all the .o
files for your app, ld -r -x them all together into one .o file. Ship
that .o file along with any other closed source ghc package .a files and
then anyone will be able to use (the right version of) ghc to link them
together along with a modified version of the Gtk2Hs .a lib. Of course
GHC doesn't make this especially easy especially since it doesn't make
preserving ABIs very easy, but fortunately that's not really your
problem.

Duncan



More information about the Haskell-Cafe mailing list