haskell install on low memory server?

Hi, I'd like to install Haskell on a linux virtual server with about 600 MB of RAM. (Maybe that is doomed to failure?) The goal is to try "happstack" for web apps, behind nginx. Compiling the whole platform is asking for OpenGL... so I thought I would get cabal and install pieces that I want. I downloaded the 'generic ghc binary' from here: http://hackage.haskell.org/platform/linux.html and that seems to work. But when I download the cabal-install tarball and try to run it's 'bootstrap.sh' I run out of memory. Is there a way to tell it to use less memory? ------- shell commands ------- $ cd cabal-install-0.10.2 $ sh bootstrap.sh Checking installed packages for ghc-7.0.2... Cabal is already installed and the version is ok. transformers-0.2.2.0 will be downloaded and installed. mtl-2.0.1.0 will be downloaded and installed. parsec-3.1.1 will be downloaded and installed. network-2.3.0.2 will be downloaded and installed. time is already installed and the version is ok. HTTP-4000.1.1 will be downloaded and installed. zlib-0.5.3.1 will be downloaded and installed. Downloading transformers-0.2.2.0... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 17148 100 17148 0 0 27246 0 --:--:-- --:--:-- --:--:-- 39420 [1 of 1] Compiling Main ( Setup.hs, Setup.o ) Linking Setup ... collect2: ld terminated with signal 9 [Killed] Error during cabal-install bootstrap: Compiling the Setup script failed ------- end of shell commands ------- It seems strange that `ld` would need to use ~450 MB, which is what it's doing to get killed by the kernel. Any ideas? thanks, Rob

On Sat, Mar 19, 2011 at 2:14 PM, Rob Nikander
Hi,
I'd like to install Haskell on a linux virtual server with about 600 MB of RAM. (Maybe that is doomed to failure?) The goal is to try "happstack" for web apps, behind nginx. Compiling the whole platform is asking for OpenGL... so I thought I would get cabal and install pieces that I want. I downloaded the 'generic ghc binary' from here: http://hackage.haskell.org/platform/linux.html and that seems to work. But when I download the cabal-install tarball and try to run it's 'bootstrap.sh' I run out of memory. Is there a way to tell it to use less memory?
You don't really need to compile GHC by yourself on the memory constrained machine. First of all, you may use a binary distribution. And second, you may compile on a different machine with more RAM. That said, compiling Haskell programs on such low memory computers isn't really difficult, provided your program isn't as big as GHC. I've been succesfully using an AWS micro instance with 595 MiB of RAM and an Yesod app. (But I have some swap memory should it be needed.) HTH, =) -- Felipe.

On Sat, Mar 19, 2011 at 10:25 AM, Felipe Almeida Lessa
On Sat, Mar 19, 2011 at 2:14 PM, Rob Nikander
wrote: ... is asking for OpenGL... so I thought I would get cabal and install pieces that I want. I downloaded the 'generic ghc binary' from here: http://hackage.haskell.org/platform/linux.html and that seems to work. But when I download the cabal-install tarball and try to run it's 'bootstrap.sh' I run out of memory. Is there a way to tell it to use less memory?
You don't really need to compile GHC by yourself on the memory constrained machine. First of all, you may use a binary distribution. And second, you may compile on a different machine with more RAM.
From the error message in my previous email, it looks like it dies
But I'm not compiling GHC, am I? I downloaded the binary, and it works. I thought I was trying to install cabal, because I don't see it included in the GHC binaries. trying to compile "transformers". I also have a Micro EC2 instance. If there was a 'yum' haskell package for this "Amazon Linux" I'd use that, but I don't see one. thanks, Rob

On Sat, Mar 19, 2011 at 2:41 PM, Rob Nikander
But I'm not compiling GHC, am I? I downloaded the binary, and it works. I thought I was trying to install cabal, because I don't see it included in the GHC binaries.
I think I have misunderstood your snippet. =)
From the error message in my previous email, it looks like it dies trying to compile "transformers".
Yes, that seems so.
I also have a Micro EC2 instance. If there was a 'yum' haskell package for this "Amazon Linux" I'd use that, but I don't see one.
I have installed Ubuntu on my micro instance and downloaded GHC from there. However I've installed many other packages through cabal. Perhaps the difference is the swap file? You may try # dd if=/dev/zero of=/tmp/swap bs=1M count=1024 # mkswap /tmp/swap # swapon /tmp/swap HTH, =) -- Felipe.

On Saturday 19 March 2011 15:14:31, Rob Nikander wrote:
Hi,
I'd like to install Haskell on a linux virtual server with about 600 MB of RAM. (Maybe that is doomed to failure?) The goal is to try "happstack" for web apps, behind nginx. Compiling the whole platform is asking for OpenGL... so I thought I would get cabal and install pieces that I want. I downloaded the 'generic ghc binary' from here: http://hackage.haskell.org/platform/linux.html and that seems to work. But when I download the cabal-install tarball and try to run it's 'bootstrap.sh' I run out of memory. Is there a way to tell it to use less memory?
------- shell commands -------
$ cd cabal-install-0.10.2 $ sh bootstrap.sh Checking installed packages for ghc-7.0.2... Cabal is already installed and the version is ok. transformers-0.2.2.0 will be downloaded and installed. mtl-2.0.1.0 will be downloaded and installed. parsec-3.1.1 will be downloaded and installed. network-2.3.0.2 will be downloaded and installed. time is already installed and the version is ok. HTTP-4000.1.1 will be downloaded and installed. zlib-0.5.3.1 will be downloaded and installed.
Downloading transformers-0.2.2.0... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 17148 100 17148 0 0 27246 0 --:--:-- --:--:-- --:--:-- 39420 [1 of 1] Compiling Main ( Setup.hs, Setup.o ) Linking Setup ... collect2: ld terminated with signal 9 [Killed]
That means it's OOM-killed while linking the setup script? That should not be (nor should it be OOM when compiling any of those packages). Although, I just tested and linking the default Setup.hs used 300MB here, so 450MB is not impossible. There's a lot to link in from the Cabal library, perhaps also the ghc-api (the unstripped executable was 5.6MB, which is surprisingly huge, the stripped is still 3.1MB, normally executables are smaller).
Error during cabal-install bootstrap: Compiling the Setup script failed
------- end of shell commands -------
It seems strange that `ld` would need to use ~450 MB, which is what it's doing to get killed by the kernel.
Any ideas?
You could try installing them (and afterwards cabal-install) the old way, $ runghc ./Setup.hs configure --user $ runghc ./Setup.hs build $ runghc ./Setup.hs install But if ghc is killed linking the default setup script, it will probably get killed each time you try to cabal install a package because that involves linking a setup script.
thanks, Rob
participants (3)
-
Daniel Fischer
-
Felipe Almeida Lessa
-
Rob Nikander