Why Can't I Install Any Packages with Ghc 7.8.4 on Raspberry Pi

Why can't I install any packages with GHC 7.8.4 on Raspberry Pi?

It needs --ghc-options=-opta-march=armv7a as an option every time you want to build something with GHC or cabal install something. With this, it works!

Update

If instead you do --ghc-options="-opta-mcpu=cortex-a7 -opta-mfpu=neon -opta-mtune=native -opta-mfloat-abi=hard, floating point will work too. I arrived at this by guessing-and-checking and reading old forum posts, so its possible that these too are not the best settings.

Cabal also has a user configuration file where you can store this setting and have it applied whenever GHC is invoked.

GHCi on raspberry pi 2?

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.

Run command from within vi / vim

Maybe you could try adding something like this to your vimrc:

function! ExecuteHS()
w
!ghc -o first %
!./first
endfunction

And to use this function you just have to call it like that :call ExecuteHS(). Vim will be put on background during the execution of your file and will then come back on foreground at the end of the execution.

As a bonus you can add the folowing line to your vimrc

nnoremap <key> :call ExecuteHS()<CR>

Replacing <key> with your prefered key combination <Leader>e for example. This way you'll simply have to hit ,e (if you didn't changed your leader key) in normal mode to call the function.

That's probably not the cleanest way to do it but it should work for what you want.



Related Topics



Leave a reply



Submit