12
rvm install 1.9.3

leads to the error in the make.log:

...
compiling ./enc/trans/emoji_sjis_docomo.c
compiling ./enc/trans/emoji_sjis_kddi.c
gcc: internal compiler error: Killed (program cc1)
gcc: internal compiler error: Killed (program cc1)
gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
...

dmesg shows

[180031.341709] send sigkill to 3705 (cc1), adj 0, size 3394

free shows at some point running configure process:

             total       used       free     shared    buffers     cached
Mem:        241668     238676       2992          0         92       2020
-/+ buffers/cache:     236564       5104
Swap:       262140     262140          0

So I assume that 256MB RAM and 256MB Swap is not enough to compile Ruby on it.

I read that it should be possible using some parameters for gcc, see: http://hostingfu.com/article/compiling-with-gcc-on-low-memory-vps

But

  rvm install 1.9.3 --with-CFLAGS="$CFLAGS --param ggc-min-expand=0 --param ggc-min-heapsize=8192"

Does not work to give the flags to gcc, log is still the same for the flags:

command(2): __rvm_make -j4
        CC = gcc
        LD = ld
        LDSHARED = gcc -shared
        CFLAGS = -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-fiel$
        XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT
        CPPFLAGS =   -I. -I.ext/include/x86_64-linux -I./include -I.
        DLDFLAGS = -Wl,-soname,libruby.so.1.9
        SOLIBS = -lpthread -lrt -ldl -lcrypt -lm

How to compile ruby on that machine?

marc
  • 977
  • 9
  • 14
  • 1
    try `rvm install 1.9.3 -- CFLAGS="$CFLAGS --param ggc-min-expand=0 --param ggc-min-heapsize=8192"` – mpapis Nov 04 '13 at 04:09
  • `[205242.284757] send sigkill to 17549 (cc1), adj 0, size 11726` as well. Now the make.log has these CFLAGS: `CFLAGS = --param ggc-min-expand=0 --param ggc-min-heapsize=8192 -fPIC` There are some flags missing that are shown initially/above. make.log continues with: ` .. configuring -test-/funcall configuring -test-/load/dot.dot gcc: internal compiler error: Killed (program cc1) gcc: internal compiler error: Killed (program cc1) Please submit a full bug report, with preprocessed source if appropriate. .. ` and ends with `configuring zlib` – marc Nov 04 '13 at 09:39
  • exported CFLAG variable, now it is `echo $CFLAGS`: `CFLAGS = --param ggc-min-expand=0 --param ggc-min-heapsize=8192 -fPIC`. `rvm reinstall 1.9.3` leads to make.log `CFLAGS = --param ggc-min-expand=0 --param ggc-min-heapsize=8192 -fPIC` and same out of memory exit. – marc Nov 04 '13 at 10:21

1 Answers1

30

Creating a 512MB swap-file solved the problem. Here are the steps:

sudo mkdir -p /var/cache/swap/
sudo dd if=/dev/zero of=/var/cache/swap/swap0 bs=1M count=512
sudo chmod 0600 /var/cache/swap/swap0
sudo mkswap /var/cache/swap/swap0 
sudo swapon /var/cache/swap/swap0

The swap file is not used after a restart. It can be integrated in /etc/fstab to use it after restart:

 /var/cache/swap/swap0    none    swap    sw      0 0

The above steps to create a swap-file I found here (in German): http://wiki.ubuntuusers.de/Swap#Swap-als-Datei - licence for the above content: http://creativecommons.org/licenses/by-nc-sa/2.0/de/deed.en (Attribution-NonCommercial-ShareAlike 2.0 Germany (CC BY-NC-SA 2.0 DE))

marc
  • 977
  • 9
  • 14