andhapp Random ramblings

Ruby 1.9.2 and RVM

RVM is no doubt an amazing piece of code. It just makes life so much easier. Ruby 1.9.2 is out. Woo-hoo! and I tried installing it with rvm only to encounter an error. I fixed the error and this post outlines my shenanigans leading to an easy solution.

Mark has done a nice post on rvm with ruby 1.9.2 and rails3. I used it as my starting point and ran the following command in the Terminal.

rvm install 1.9.2 -C --with-readline-dir=/opt/local,--build=x86_64-apple-darwin10

It downloads the ruby 1.9.2 and errors whilst running make. Here’s the rvm error message:

info: Installing Ruby from source to: /Users/andhapp/.rvm/rubies/ruby-1.9.2-p0

info: /Users/andhapp/.rvm/src/ruby-1.9.2-p0 has already been extracted.

info: Configuring ruby-1.9.2-p0, this may take a while depending on your cpu(s)...

info: Compiling ruby-1.9.2-p0, this may take a while depending on your cpu(s)...

error: Error running 'make ', please check /Users/andhapp/.rvm/log/ruby-1.9.2-p0/make*.log

error: There has been an error while running make. Aborting the installation.

This points at a make error log. Further investigation of the make.error.log file revealed the following error message (only the last 10 lines):

_sdbm.c: In function ‘chkpage’:
_sdbm.c:864: warning: comparison between signed and unsigned
raddrinfo.c: In function ‘nogvl_getaddrinfo’:
raddrinfo.c:140: warning: passing argument 3 of ‘ruby_getaddrinfo__darwin’ discards qualifiers from pointer target type
bytecode.re: In function ‘sycklex_bytecode_utf8’:
bytecode.re:442: warning: implicit conversion shortens 64-bit value into a 32-bit value
rubyext.c: In function ‘mktime_do’:
rubyext.c:278: warning: comparison between signed and unsigned
/Library/Ruby/Gems/1.8/gems/rdoc-2.4.3/lib/rdoc/rdoc.rb:51: warning: already initialized constant GENERATORS
[BUG] cross-thread violation on rb_gc()
ruby 1.8.6 (2009-06-08) [universal-darwin9.0]

make: *** [rdoc] Abort trap

There’s a very strange thing in this error message. For some reason, it is referencing ruby 1.8.6. But, why? Well, I am not sure what causes it but here’s how I fixed it. My default system ruby is version 1.8.6 and that was the current ruby in the context when I ran the rvm command. I used rvm to change the current ruby to 1.9.2-preview1 and then re-ran the command. Volia! It worked.

No idea what causes it but worth investigating!