8

I'm working on a few haskell projects that run on a raspberry pi 2 and the version of ghc that you can install with apt-get from raspbian (7.4.1). It has no GHCi though, which prevents some vital packages (like Vector) from compiling. I've seen a few rumors about being able to get later versions of ghc (with ghci) onto the pi, but nothing recent. The entry on the haskell wiki looks a couple years out of date. Has anyone had any luck with this?

1 Answer 1

10

I have had some luck with this!

sagemuej@sagemuej-Aspire-5742G:~$ ssh pi-loc
Linux raspberrypi 3.12.28+ #709 PREEMPT Mon Sep 8 15:28:00 BST 2014 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed Apr  1 00:24:44 2015 from sagemuej-aspire-5742g.localdomain
pi@raspberrypi:~$ ghci
GHCi, version 7.8.2: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :m +Data.Vector
Prelude Data.Vector> fromList [1,2,3]
Loading package array-0.5.0.0 ... linking ... done.
Loading package deepseq-1.3.0.2 ... linking ... done.
Loading package primitive-0.5.2.1 ... linking ... done.
Loading package vector-0.10.9.1 ... linking ... done.
fromList [1,2,3]

Ain't it nice?

It is a full GHC 7.8. I had to bootstrap it from source, though. Worked pretty fine by the normal setup instructions if I recall correctly – though it took ages to build (like, half a week).

The main issue is memory: for some of the larger modules, the compiler needs more than the π can offer even when running without X. What I did was simply, I connected a USB hard drive and set up a swap partition on it. Of course, swapping makes everything even slower, but eventually it'll succeed. Did for me, at least.

19
  • That's great news! Would you consider making the compiled binaries available?
    – jhickner
    Apr 1, 2015 at 1:11
  • 1
    I suppose I should, shouldn't I? I've never packaged any binaries, but I reckon it can't be so difficult. I'll think about it... Apr 1, 2015 at 9:16
  • 1
    You people are crazy!... I approve. Apr 1, 2015 at 10:24
  • I'm trying 7.8.4 right now! @leftaroundabout did you build on a pi or pi2? I'm hoping the extra cores will speed things up. I ran make with 5 jobs. Also I chose the quick build option which leaves out profiling.
    – jhickner
    Apr 1, 2015 at 20:33
  • rpi 1 model B. – As I said, the biggest hurdle was memory, so it'll probably compile much faster on the π 2. (In my case, the time spent swapping was probably by far the biggest contribution.) Apr 1, 2015 at 21:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.