Consider integer-simple build
Closed this issue · 3 comments
As best I can tell, building executables with the default ghc arguments, like ghc --make main.hs
statically link libgmp (on OSX). On Linux, libgmp is dynamically linked by default. libgmp is released under GNU LGPL V3 or GNU GPL v2.0. I am not a lawyer, but my understanding is, at the very least, this limits the licensing you're able to distribute your executables under. You can build your executables with -dynamic
, but this then requires that your users have libgmp on their system. integer-simple is a pure-Haskell alternative to using libgmp. It is released under the BSD3 license. More resources about Integers in Haskell are available. By compiling GHC with integer-simple, we could offer users the ability to easily create Haskell executables that are easily distributable (require no dependencies), and are not encumbered by licensing. I'm imagining, at first anyway, that this is simple an alternative download to the current ghc.app download. Thoughts?
Right now ghc.app just uses the bindist from http://www.haskell.org/ghc/download - but this sounds like a reasonable request for the GHC team. You're right that distributing a statically linked libgmp in a non-GPL app sure sounds questionable.
Cool, I'll start a thread suggesting this to the GHC team. FWIW, I have successfully compiled GHC with integer-simple on OSX Mavericks, without too much effort. An example is below:
➜ /tmp ghc --make main.hs
[1 of 1] Compiling Main ( main.hs, main.o )
Linking main ...
➜ /tmp otool -L main
main:
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
➜ /tmp ./main
Hello, integer-simple world!
➜ /tmp ghc --make -dynamic main.hs
[1 of 1] Compiling Main ( main.hs, main.o )
Linking main ...
➜ /tmp otool -L main
main:
@rpath/libHSbase-4.7.0.1-ghc7.8.3.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/libHSinteger-simple-0.1.1.0-ghc7.8.3.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/libHSghc-prim-0.3.1.0-ghc7.8.3.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/libHSrts-ghc7.8.3.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/libffi.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
👍 the reason why I depend on the bindist is mostly to save time and because that's what Haskell Platform tends to do. Doing a full build isn't out of the question, but the leaner this project is the better :)