加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

如何在低内存系统上使用RVM编译ruby?

发布时间:2020-12-16 20:18:05 所属栏目:百科 来源:网络整理
导读:rvm install 1.9.3 导致make.log中的错误: ...compiling ./enc/trans/emoji_sjis_docomo.ccompiling ./enc/trans/emoji_sjis_kddi.cgcc: internal compiler error: Killed (program cc1)gcc: internal compiler error: Killed (program cc1)gcc: internal c
rvm install 1.9.3

导致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显示

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

免费显示在某些时候运行配置进程:

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

所以我假设256MB RAM和256MB的交换不足以编译Ruby.

我读到,应该可以使用gcc的一些参数,参见:
http://hostingfu.com/article/compiling-with-gcc-on-low-memory-vps

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

不行给gcc的标志,日志还是一样的标志:

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

如何在该机器上编译ruby?

解决方法

创建一个512MB的交换文件解决了这个问题.以下是步骤:
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

重新启动后不使用交换文件.它可以集成在/ etc / fstab中,以便在重启后使用它:

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

以上步骤创建我在这里找到的交换文件(德语):http://wiki.ubuntuusers.de/Swap#Swap-als-Datei – 上述内容的许可证:http://creativecommons.org/licenses/by-nc-sa/2.0/de/deed.en(Attribution-NonCommercial-ShareAlike 2.0德国(CC BY-NC-SA 2.0 DE))

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读