Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to produce stand alone haskell executable

Is there any way to produce stand alone haskell executable to run on different linux machines assuming the architecture is similar?

Sorry I should have been clearer. The other machines might not have ghc installed on them - a bit like pyinstaller for python is what I was looking for?

like image 946
opensourcegeek Avatar asked Apr 22 '13 14:04

opensourcegeek


2 Answers

You can use the flags -static -optl-pthread -optl-static to avoid dynamically linked dependencies when compiling a Haskell project. This should help you run the compiled executable on two linux machines that do not have the exact same library versions.

like image 104
shang Avatar answered Oct 25 '22 23:10

shang


Yes it is possible. Just like with gcc-produced binaries, you can copy them between systems assuming the dynamic libraries and platforms match.

In practice, that's a slightly higher bar than GCC binaries because GHC will dynamically link more libraries by default (ex: libgmp, unless you build GHC using integer-simple).

like image 36
Thomas M. DuBuisson Avatar answered Oct 25 '22 22:10

Thomas M. DuBuisson