RVM not compiling ruby 1.9.3 - compilation

I'm having an issue with RVM that I haven't seen before. I'm trying to install ruby 1.9.3 but it installs a binary version instead of compiling:
rvm install 1.9.3
Searching for binary rubies, this might take some time.
ruby-1.9.3-p362 - #configure
ruby-1.9.3-p362 - #download
ruby-1.9.3-p362 - #validate archive
tar: Record size = 8 blocks
tar: Record size = 8 blocks
ruby-1.9.3-p362 - #extract
ruby-1.9.3-p362 - #validate binary
ruby-1.9.3-p362 - #setup
Saving wrappers to '/home/vagrant/.rvm/bin'.
ruby-1.9.3-p362 - #importing default gemsets, this may take time ...
Then if I try
$ rvm use 1.9.3
$ ruby -v
$ ruby 1.9.3p362 (2012-12-25 revision 38607) [i686-linux]
However, there are no sources:
$ ls .rvm/src/
ruby-1.8.7-p371 rubygems-1.8.24 rvm yaml-0.1.4
Is there any reason why RVM is not compiling ruby 1.9.3?
Thanks for your help!

Compiling ruby takes time, RVM provides binary rubies so Ruby can be installed faster and that no compilations errors break installation.
You could check rvm help install where first line is:
Usage
rvm install {ruby-string} [--verify-download {0,1,2}] [--binary|--disable-binary|--movable]
so it's enough to use:
rvm reinstall 1.9.3 --disable-binary
but if you only need sources then run:
rvm fetch 1.9.3

Related

RVM and Ruby version not working as expected

I want to install the compass html5 boilerplate gem. When I try to install it I get the following error.
$ sudo gem install html5-boilerplate
ERROR: Error installing html5-boilerplate:
compass-h5bp requires Ruby version ~> 2.0.
Then when I check my ruby version it says:
$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
But I used RVM before so I thought I could just change version but when I check it says I'm using ruby-2.2.0 already.
$ rvm list
rvm rubies
=* ruby-2.2.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
I think I must be missing something obhvious, it's been a while since I've worked with Ruby and RVM.
Update 1
I ran the below commands as suggested by #tadman and it does seem the wrong path is being used.
~:$ cd ~/.rvm/bin
bin:$ ls
ruby-rvm-env rvm rvm-auto-ruby rvm-exec rvm-prompt rvm-shebang-ruby rvm-shell rvm-smile rvmsudo
bin:$ which ruby
/usr/bin/ruby
UPDATE 2
After correcting the path in my .bash_profile the ruby version seems correct but I'm still getting the same error when trying to install the html5-boilerplate gem??
$ sudo gem install html5-boilerplate
ERROR: Error installing html5-boilerplate:
compass-h5bp requires Ruby version ~> 2.0.
$ ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
$ rvm list
rvm rubies
=* ruby-2.2.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
$ compass -v
Compass 1.0.3 (Polaris)
Copyright (c) 2008-2015 Chris Eppstein
Released under the MIT License.
Compass is charityware.
Please make a tax deductable donation for a worthy cause: http://umdf.org/compass
Also i have the compass gem installed on both Ruby 1.9.1 and RVM's ruby 2.2.0. Could this have something to do with it?
$ pwd
/var/lib/gems/1.9.1/gems/compass-1.0.3
$ cd /home/ross/.rvm/gems/ruby-2.2.0/gems/compass-1.0.3
$ pwd
/home/ross/.rvm/gems/ruby-2.2.0/gems/compass-1.0.3
Is there a way to check which ruby version compass is using?
Having RVM and having RVM installed correctly are two different things. The most common cause of a mismatch like this is that your system Ruby has priority in your PATH.
In a POSIX shell, which ruby will tell you which one is getting executed. It is probably the wrong one.
RVM does its magic by manipulating which Ruby shows up in the RVM bin path, often ~/.rvm/bin or something similar. To get it to work correctly you'll need to ensure that path is first in your $PATH.
You may want to try reinstalling the RVM stub, or check that it's correctly loaded into your environment.

How to install ruby 1.8.7 on ubuntu 12.04 with rvm?

I'm working with a legacy rails system. I need a copy of ruby 1.8.7
I've just been given a new computer at work (finally) and it has ubuntu 12.04
Unfortunately I've just discovered that the rvm-rubies available for my system do not contain 1.8.7 (see list below)
How can I install ruby 1.8.7?
Is there another source that I can point to that will work?
Please note: I did not use apt-get to install rvm, that is not the problem
This is the list of available rubies:
# Rubies available for 'ubuntu/12.04/x86_64':
ruby-1.9.3-p194
ruby-1.9.3-p286
ruby-1.9.3-p327
ruby-1.9.3-p362
ruby-1.9.3-p374
ruby-1.9.3-p392
ruby-1.9.3-p429
ruby-1.9.3-p448
ruby-2.0.0-p0
ruby-2.0.0-p195
ruby-2.0.0-p247
Edit:
Just so you know, here's the output of some of the simpler rvm commands:
triton:[~]% rvm list
rvm rubies
# No rvm rubies installed yet. Try 'rvm help install'.
And rvm install gives this message (which make sit clear there is no version of 1.8.7 in the standard repository).
triton:[~]% rvm install 1.8.7
Searching for binary rubies, this might take some time.
No binary rubies available for: ubuntu/12.04/x86_64/ruby-1.8.7-p374.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
You requested building with 'gcc-4.4' but it is not in your path.
From the documentation:
To install a specific tagged version of ruby from the repository we
specify -t(tag name).
It then goes on to talk about branches...
Repository Branches (MRI)
To install a specific branch version of ruby from the repository we specify --branch (branch name). Named rubies can help avoid clashes.
$ rvm install ruby-head -n zombie --branch ruby_1_8 && rvm ruby-head-zombie
$ ruby -v
ruby 1.8.8dev (2012-05-21) [i386-darwin10.8.0]
$ rvm install ruby-head -n newborn && rvm ruby-head-newborn
$ ruby -v
ruby 2.0.0dev (2012-06-03 trunk 35876) [x86_64-darwin10.8.0]
You'll find a list of all valid branches in the ruby repository: http://svn.ruby-lang.org/repos/ruby/branches/
You have access to much more than what is shown.
ruby_1_3/
ruby_1_4/
ruby_1_6/
ruby_1_8/
ruby_1_8_5/
ruby_1_8_6/
ruby_1_8_7/
ruby_1_9_1/
ruby_1_9_2/
ruby_1_9_3/
ruby_2_0_0/
More hints on the RVM official website
Also, for additional help, the IRC Chat room on freenode.net is awesome!
what you have presented is output from rvm list remote - which list binary (already compiled) rubies for your system, to see more possible choices of version run rvm list which will include 1.8.7:
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-p374]
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p320]
[ruby-]1.9.3[-p448]
[ruby-]2.0.0-p195
[ruby-]2.0.0[-p247]
[ruby-]2.0.0-head
ruby-head
and it continues with number of other ruby distributions.
If not sure you can always just run:
rvm install 1.8.7
RVM does all kind of detections and will most likely know what to do with specified version.
For future reference: I figured it out.
The important clue was in the last line of the result for rvm install:
You requested building with 'gcc-4.4' but it is not in your path.
I had gcc version 4.6 but my .zshrc (copied from my previous computer) was pointing at this older version.
Because of this, rvm thought I didn't have a c-compiler. Which means that rvm wasn't able to install any rubies from source - only pre-compiled rubies - which means it was restricted to only those already pre-compiled for my platform (ie 64-bit ubuntu 12.04)
When I fixed the gcc line in my .zshrc - rvm was able to figure out how to install+compile source-code rubies - including v1.8.7

"ruby -v" no longer returning current version

In the process of trying to upgrade to Ruby 1.9.3, I think I broke something. I believe I have Ruby 1.9.3 successfully installed. However, now when I type ruby -v into terminal, I'm not getting any messages. Here's the sample output:
rish-macbookair:~ rish$ ruby -v
rish-macbookair:~ rish$
One of the last things I did was install the "Command Line Tools" in XCode because I was getting a "missing libraries" error.
Any ideas on what might have happened, or where to start?
Edit: upon trying to reinstall 1.9.3, I get this:
rish-macbookair:~ rish$ rvm reinstall 1.9.3
/usr/local/rvm/src/ruby-1.9.3-p327 has already been removed.
Removing /usr/local/rvm/rubies/ruby-1.9.3-p327...
https://rvm.io/binaries/osx/10.8/x86_64/ruby-1.9.3-p327.tar.bz2 - #configure
ruby-1.9.3-p327 - #download
ruby-1.9.3-p327 - #extract
ruby-1.9.3-p327 - #validate
ruby-1.9.3-p327 - #setup
sed: RE error: illegal byte sequence
Saving wrappers to '/usr/local/rvm/bin'.
ruby-1.9.3-p327 - #importing default gemsets (/usr/local/rvm/gemsets/), this may take time ...
Making gemset ruby-1.9.3-p327 pristine.
Making gemset ruby-1.9.3-p327#global pristine.
rish-macbookair:~ rish$
I have tried reinstalling RVM as well, but I'm back in the same place
you are using old version of rvm, try:
rvm get head
rvm reinstall 1.9.3
rvm use 1.9.3

Ruby installation issue using RVM

I am having trouble installing Ruby using RVM. I had tried using readline and other suggestions online. None of the solutions worked.
I use Cygwin, Bash and have RVM installed.
rvm install 1.9.2
No binary rubies available for: /ruby-1.9.2-p320.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Fetching yaml-0.1.4.tar.gz to /home/arvenkataraman/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /home/arvenkataraman/.rvm/src
Configuring yaml in /home/arvenkataraman/.rvm/src/yaml-0.1.4.
Compiling yaml in /home/arvenkataraman/.rvm/src/yaml-0.1.4.
Error running 'make', please read /home/arvenkataraman/.rvm/log/ruby-1.9.2-p320/yaml/make.log
Installing Ruby from source to: /home/arvenkataraman/.rvm/rubies/ruby-1.9.2-p320, this may take a while depending on your cpu(s)...
ruby-1.9.2-p320 - #downloading ruby-1.9.2-p320, this may take a while depending on your connection...
ruby-1.9.2-p320 - #extracting ruby-1.9.2-p320 to /home/arvenkataraman/.rvm/src/ruby- 1.9.2-p320
ruby-1.9.2-p320 - #extracted to /home/arvenkataraman/.rvm/src/ruby-1.9.2-p320
ruby-1.9.2-p320 - #configuring
ruby-1.9.2-p320 - #compiling
ruby-1.9.2-p320 - #installing
ruby-1.9.2-p320 is not installed.
To install do: 'rvm install ruby-1.9.2-p320'
I see the below in the error log "/home/arvenkataraman/.rvm/log/ruby-1.9.2-p320/yaml/make.log"
$ cat /home/arvenkataraman/.rvm/log/ruby-1.9.2-p320/yaml/make.log
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /home/arvenkataraman/.rvm/src/yaml-0.1.4/config/missing --run aclocal-1.11
cd . && /bin/sh /home/arvenkataraman/.rvm/src/yaml-0.1.4/config/missing --run automake-1.11 --foreign
src/Makefile.am:2: Libtool library used but `LIBTOOL' is undefined
src/Makefile.am:2: The usual way to define `LIBTOOL' is to add `LT_INIT'
src/Makefile.am:2: to `configure.ac' and run `aclocal' and `autoconf' again.
src/Makefile.am:2: If `LT_INIT' is in `configure.ac', make sure
src/Makefile.am:2: its definition is in aclocal's search path.
Makefile:256: recipe for target `Makefile.in' failed
make: *** [Makefile.in] Error 1
This work for me make sure RVM is up to date
rvm get head
CC=/usr/bin/gcc rvm install 1.9.2 --enable-shared
note: /usr/bin/gcc ==> path/to/gcc
few steps:
update RVM: rvm get head
read and follow instructions: rvm requirements
reinstall ruby: rvm reinstall 1.9.2

How to upgrade Ruby on Fedora

I'm trying to upgrade Ruby to 1.8.7 on Fedora 13 (yes I know it's old) using rvm. I'm a little new to the Ruby world, but this is what I've done so far:
~$ yum -y install rubygem-rvm
...
~$ rvm-install
...
~$ rvm install 1.8.7
/usr/local/rvm/rubies/ruby-1.8.7-p302, this may take a while depending on your cpu(s)...
ruby-1.8.7-p302 - #fetching
ruby-1.8.7-p302 - #extracted to /usr/local/rvm/src/ruby-1.8.7-p302 (already extracted)
ruby-1.8.7-p302 - #configuring
ruby-1.8.7-p302 - #compiling
ruby-1.8.7-p302 - #installing
ruby-1.8.7-p302 - #rubygems installing to ruby-1.8.7-p302
ruby-1.8.7-p302 - adjusting #shebangs for (gem).
ruby-1.8.7-p302 - #importing default gemsets (/usr/local/rvm/gemsets/)
Install of ruby-1.8.7-p302 - #complete
~$ rvm use 1.8.7 --default
Using /usr/local/rvm/gems/ruby-1.8.7-p302
~$ ruby -v
ruby 1.8.6 (2010-09-02 patchlevel 420) [x86_64-linux]
~$ rvm use 1.8.7
Using /usr/local/rvm/gems/ruby-1.8.7-p302
~$ ruby -v
ruby 1.8.6 (2010-09-02 patchlevel 420) [x86_64-linux]
Everything seems to run fine, except Ruby 1.8.6 is still the default version.
What other steps am I missing to switch the default Ruby version to 1.8.7?
EDIT: It seems there's some really unintuitive behavior in rvm. If you don't install certain packages, then when you use rvm to install a specific Ruby version, rvm not only won't build or install that Ruby version, it won't even tell you it's not building Ruby. I noticed there was no bin directory in /usr/local/rvm/gems/ruby-1.8.7-p302...which was unusually, being that Ruby is a binary and all. So I double checked the docs, and found a list of Fedora packages to install:
yum install -y bash curl git
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel
yum install -y iconv-devel
After those were installed, running rvm install 1.8.7 correctly built a Ruby binary. Oddly, running rvm use 1.8.7 --default still doesn't update the default Ruby version, so I did:
cp /usr/bin/ruby /usr/bin/ruby-1.8.6
rm -f /usr/bin/ruby
ln -s /usr/local/rvm/rubies/ruby-1.8.7-p302/bin/ruby /usr/bin/ruby
Be sure to run ruby -v in the same shell where you ran rvm use 1.8.7. I'm not sure what the --default option does so try leaving it off.
Not positive, this could be a few things. My guess is this though.
You might need to switch the linker to point at your new installation (the "shortcut" file in /usr/bin/). Find where you installed your new version of ruby. If the "ruby" linker in /usr/bin/ does not point to this new installation, make a new link by right-clicking on the ruby executable and make a link, put it /usr/bin/.
That's my only guess, I had this problem when I installed a new version of python.

Resources