ruby-packer icon indicating copy to clipboard operation
ruby-packer copied to clipboard

rubyc takes forever to compile (Gets stuck at compiling prelude.c step)

Open nilarte opened this issue 7 years ago • 4 comments

Hi these are the steps I followed: yum install centos-release-scl yum install devtoolset-7 scl enable devtoolset-7 bash

rvm install ruby-2.2.1 rvm use ruby-2.2.1 gem install My_application.gem

Unpack the gem file to a temp directory:

tar xf My_application.gem tar xf data.tar.gz cd bin

Edited main file and added these two lines to the top, before any non-comment lines (As suggested in https://github.com/pmq20/ruby-packer/issues/39#issuecomment-417965898):

require 'rubygems' require 'bundler/setup'

Now building it like this rubyc ./My_edited_main_file

However it keeps getting stuck at this point: .... compiling addr2line.c compiling dln.c compiling localeinit.c compiling prelude.c

Most likely it s not hung but just terribly slow.

When I atttched strace to cc1 process it is actually doing some work but at very slow speed. [nil@localhost ~]$ strace -p 12853 strace: Process 12853 attached brk(NULL) = 0x9403000 brk(0x9424000) = 0x9424000 mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff0969b8000 brk(NULL) = 0x9424000 brk(0x9446000) = 0x9446000

I have spent almost six hours hoping to get past "compiling prelude.c" step Desperately need to make this work Any help is appreciated.

BTW 2 machines I am trying this are not very high end. 2 GB / 3 GB RAM plus arround 5 GM manually created swapfile space. Will this cause an issue by any chance?

nilarte avatar Sep 15 '18 15:09 nilarte

hi, i use rubyc too. yes, i think you need more RAM, because i have 8 GB RAM and 6 GB Swapfile and i was wondered that compiling prelude.c take my all RAM and some space from swap. I think the better case when RAM is near 12 GB.

iamsimakov avatar Sep 19 '18 14:09 iamsimakov

@iamsimakov Thanks a lot and sorry for late reply.

So we used slightly different approach to run rubyc and it worked.

This is how we did it

mkdir /tmp/staging_dir ##( Copy My_application.gem to /tmp/staging_dir/) ##(That directory should contain only that file and nothing else)

rubyc -r /tmp/staging_dir -o /tmp/my_precompiled_output_binary

Thanks again

nilarte avatar Sep 26 '18 10:09 nilarte

Also feel free to close this issue!

nilarte avatar Sep 26 '18 11:09 nilarte

hi, issue authors or repo maintainers only can close it)

iamsimakov avatar Sep 26 '18 21:09 iamsimakov