Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A script to install stack on Raspbian
#!/bin/sh
set +ex
# A script to install stack on Raspbian
# Use stack installer script to install stack
curl -sSL https://get.haskellstack.org/ | sh
# Use apt-get to install llvm
sudo apt-get install llvm-3.7
# Write a wrapper for ghc to be called with, parameterizing GHC with ARM settings
cat > ~/.stack/programs/arm-linux/ghc-8.0.1/bin/ghc-arm-wrapper.sh <<EOF
#!/bin/sh
ghc-8.0.1 -opta-march=armv7-a $@
EOF
# Setup symlinks for stack / ghc
ln -s /usr/bin/opt-3.7 /usr/bin/opt
ln -s /usr/bin/llc-3.7 /usr/bin/llc
rm ~/.stack/programs/arm-linux/ghc-8.0.1/bin/ghc
ln ~/.stack/programs/arm-linux/ghc-8.0.1/bin/ghc-arm-wrapper.sh ~/.stack/programs/arm-linux/ghc-8.0.1/bin/ghc
@alogic0

This comment has been minimized.

Copy link

alogic0 commented Feb 6, 2017

Is there enough memory for compiling on Raspberry Pi?

@ppelleti

This comment has been minimized.

Copy link

ppelleti commented Feb 8, 2017

@alogic0, I have a 512MB Model B, and I can compile on it just fine, although it's slow, and I had to increase the swap space. Just edit the file /etc/dphys-swapfile and change CONF_SWAPSIZE=100 to something much larger, like CONF_SWAPSIZE=2048.

@ghost

This comment has been minimized.

Copy link

ghost commented Aug 31, 2017

On Raspbian Stretch (released in August 2017), I didn't have to do such a complex setup. This is all I had to do:

  1. Download second latest Stack release for Linux-Arm from official repository on GitHub.
  2. Extract it; run ./stack upgrade.
  3. sudo apt-get install llvm-3.7
@ghost

This comment has been minimized.

Copy link

ghost commented Aug 31, 2017

What does -opta-march=armv7-a do? Why was/is it neccessary? Should I also add sucha wrapper for GHC although it works fine for me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.