[Haskell-beginners] haskell install on low memory server?

Daniel Fischer daniel.is.fischer at googlemail.com
Sat Mar 19 16:11:21 CET 2011

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- will be downloaded and installed.
> mtl- will be downloaded and installed.
> parsec-3.1.1 will be downloaded and installed.
> network- will be downloaded and installed.
> time is already installed and the version is ok.
> HTTP-4000.1.1 will be downloaded and installed.
> zlib- will be downloaded and installed.
> Downloading transformers-
>   % 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 
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

More information about the Beginners mailing list