4

I am trying to install Haskell Platform on a provisioned machine (puppet). The "box" I'll be using will have 512mb memory and is Ubuntu 12 64 bit. First I installed GHC 7.6.3 via the tarball (so configure and make install). That went fine.

After that puppet will download the Haskell platform 2013.2. It will also do configure and make install. But that will fail due the restricted amount of memory available;


Notice: /Stage[main]/Haskell::Platform/Exec[haskell platform install]/returns: scripts/build.sh
Notice: /Stage[main]/Haskell::Platform/Exec[haskell platform install]/returns: **************************************************
Notice: /Stage[main]/Haskell::Platform/Exec[haskell platform install]/returns: Scanning system for any installed Haskell Platform components...
Notice: /Stage[main]/Haskell::Platform/Exec[haskell platform install]/returns: 
Notice: /Stage[main]/Haskell::Platform/Exec[haskell platform install]/returns: Found:
Notice: /Stage[main]/Haskell::Platform/Exec[haskell platform install]/returns: None.
Notice: /Stage[main]/Haskell::Platform/Exec[haskell platform install]/returns: 
Notice: /Stage[main]/Haskell::Platform/Exec[haskell platform install]/returns: New packages to install: 
Notice: /Stage[main]/Haskell::Platform/Exec[haskell platform install]/returns:  HUnit-1.2.5.2 OpenGLRaw-1.3.0.0 GLURaw-1.3.0.0 OpenGL-2.8.0.0 GLUT-2.4.0.0 html-1.0.1.2 parallel-3.2.0.3 primitive-0.5.0.1 random-1.0.1.1 QuickCheck-2.6 alex-3.0.5 split-0.2.2 stm-2.4.2 async-2.0.1.4 syb-0.4.0 haskell-src-1.0.1.5 text-0.11.3.1 attoparsec-0.10.4.0 hashable-1.1.2.5 case-insensitive-1.0.0.1 transformers-0.3.0.0 mtl-2.1.2 fgl-5.4.2.4 happy-1.18.10 parsec-3.1.3 network-2.4.1.2 HTTP-4000.2.8 regex-base-0.93.2 regex-posix-0.95.2 regex-compat-0.95.1 unordered-containers-0.2.3.0 vector-0.10.0.1 xhtml-3000.2.1 cgi-3001.1.7.5 zlib-0.5.4.1 cabal-install-1.16.0.2 haskell-platform-2013.2.0.0
Notice: /Stage[main]/Haskell::Platform/Exec[haskell platform install]/returns: 
Notice: /Stage[main]/Haskell::Platform/Exec[haskell platform install]/returns: **************************************************
Notice: /Stage[main]/Haskell::Platform/Exec[haskell platform install]/returns: Building HUnit-1.2.5.2
Notice: /Stage[main]/Haskell::Platform/Exec[haskell platform install]/returns: "/usr/local/bin/ghc" "--make" "Setup" "-o" "Setup" "-package" "Cabal-1.16.0"
Notice: /Stage[main]/Haskell::Platform/Exec[haskell platform install]/returns: Linking Setup ...
Notice: /Stage[main]/Haskell::Platform/Exec[haskell platform install]/returns: collect2: ld terminated with signal 9 [Killed]
Notice: /Stage[main]/Haskell::Platform/Exec[haskell platform install]/returns: 
Notice: /Stage[main]/Haskell::Platform/Exec[haskell platform install]/returns: Error:
Notice: /Stage[main]/Haskell::Platform/Exec[haskell platform install]/returns: Compiling the Setup script failed
Notice: /Stage[main]/Haskell::Platform/Exec[haskell platform install]/returns: make: *** [build.stamp] Error 2


So I googled: "collect2: ld terminated with signal 9 [Killed]" and came to the conclusion it was a memory problem (Why is the linker terminating on me? when i build CLang). No problem if you will provision with Vagrant. I upped the available memory to 2GB and the install went FINE

However I want to deploy it to digital ocean where you'll have a restricted amount of memory available aswell. To solve this issue you can also create or increase the size of a swap file. So I made a swap file of 4GB. And ran provisioning again. This fails with the same error as before:

collect2: ld terminated with signal 9 [Killed]

I am using a puppet script to create the swap file: https://gist.github.com/philfreo/6576492

I've verified the creation of the file and it is there.

What am I missing?

Community
  • 1
  • 1
mark_dj
  • 984
  • 11
  • 29
  • 1
    Are you sure that you really need to compile ghc+haskell platform from source on that machine? Could simply installing the ready-made ubuntu packages ( http://packages.ubuntu.com/search?keywords=haskell-platform ) be a solution? – Peteris Mar 18 '14 at 22:28
  • Yes that would solve it. However on my local machine it installed a old version of GHC (7.4.1) for some reason. I tried reinstalling, but didn't help. Also you'll be dependant whenever a new version of GHC comes out you'll need to wait for a debian package in the repo. A new version of GHC is on it's way, so I would rather take this route to avoid upgrade lag ;) – mark_dj Mar 18 '14 at 22:32
  • 2
    Again, perhaps you can rethink the need for compiling at all. If you want to deploy your software to memory-limited locations, you don't need to install GHC or haskell platform - you can transfer just the compiled binary executable to digital ocean and not install anything. – Peteris Mar 18 '14 at 22:37
  • 1
    I've tried that route :) I am developing on MacOSX so if you create a binary it won't work on Ubuntu. There are also flags for static linking, but that didn't work quite work out on MacOSX and also on ubuntu (libq trouble, using postgresql-simple in my haskell project) – mark_dj Mar 18 '14 at 22:43

0 Answers0