how can I build cabal-install on eeePc 701 / Ubuntu Netbook Remix 1.6 (Lucid)

邮差的信 提交于 2019-12-03 16:02:42

I have the same issue. I add splitobjs=NO at anytime in ghc-..ebuild. then I rebuild ghc, but cabal-install still can't pass ld. because my gentoo box has no swap partition. So I use my 2G usb disk to create one temporary swap partition. then I can build cabal-install success. I found it will use extra 100M swap space and my eeepc has 512M memory. So I think you can use one usb disk that has more than 100M space. just: mkswap /dev/sd* swapon /dev/sd*

What is happening is that the kernel is killing the ld linker process because it is using too much memory.

The reason ld is using so much memory is because of a feature called "split objs" which has the consequence that standard libraries like libHSbase.a contain 10s of thousands of tiny little .o files. The linker is not optimised for this use-case and ends up using a lot of memory.

The "split objs" feature is intended to make compiled programs much smaller by linking in only the bits of the standard libraries that are actually used. It works by splitting each compiled Haskell module into a separate .o file for each function.

So this is obviously a problem for systems with less memory, like your netbook. It is likely to happen with anything you link, not just cabal. It is possible to build ghc from source with the splitobjs feature turned off. For example, Gentoo does this automatically for machines with 512Mb of RAM or less. So if you want to use ghc reliably on your netbook you'll probably need to build it from source without splitobjs. You can build ghc on a slightly more powerful machine and then transfer it to your netbook.

In future this problem will go away when we switch to using shared libraries by default on Linux.

dd if=/dev/zero of=/swapfile bs=1024 count=2048k mkswap /swapfile swapon /swapfile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!