[Haskell-cafe] Solutions for multi-platform compilation?

Ivan Perez ivanperezdominguez at gmail.com
Thu Jul 12 11:43:14 CEST 2012

 I work developing multi-platform applications in Haskell. This poses
the following problem: I cannot compile binaries for windows from
linux (AFAIK). I "solved" this problem with the following
sledgehammer:  I installed windows in a VM, I installed GHC, I
installed all the C/C++ headers & binaries of the libraries that I use
(Gtk, OpenGL, SDL, OpenCV, etc.) their Haskell counterparts, and I
created several scripts that connect to the VM using SSH, push the
changes to the repo, cabal clean & cabal install all my packages in
sequence without me having to even login into the windows machine. I
did this because I was unable to get GHC to run properly in Wine at
that time (over 2 years ago).

 This solution is still unsatisfactory because:
 1) It's slow, even though Windows itself works fine (well, as well as
windows can work, but it runs at a decent spped, I can play games and
 2) When I update a library with lots of dependencies, or GHC itself,
I have to rebuild almost everything. This is particularly painful with
big packages like Gtk, for instance. Because I have to tell cabal
where headers and libraries are located, updating a package is almost
never an automatic process. I haven't always been able to make GHC
"just pick them up" properly with pkg-config.
 3) When I make a change in a library with lots of dependencies,
recompiling all the packages can take several hours.

I don't think it's a problem with my machine: I'm giving a fair amount
of resources to windows, and I use a 3Ghz quadcore with 8GB of RAM.

Another relevant fact is: I use this for commercial purposes. I have
customers, each requiring a completely different program, they do not
have infinite budgets and, if there's a problem in the compilation
process and something requires my attention and manual intervention
too often, my salary per hour can easily drop to a ridiculous amount.
If I'm going to redo this, I'd rather just redo it once.

Any suggestions? How do you solve this kind of problem in your work environment?


More information about the Haskell-Cafe mailing list