What are the dependencies given on "rvm requirements" useful for? - ruby-on-rails

Why does RVM, Ruby or Rails need libc6-dev, ncurses-dev and libtool ?
on Ubuntu running rvm requirements gives us:
Requirements for Linux ( DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.10
DISTRIB_CODENAME=maverick
DISTRIB_DESCRIPTION="Ubuntu 10.10" )
NOTE: 'ruby' represents Matz's Ruby Interpreter (MRI) (1.8.X, 1.9.X)
This is the original / standard Ruby Language Interpreter
'ree' represents Ruby Enterprise Edition
'rbx' represents Rubinius
bash >= 4.1 required
curl is required
git is required (>= 1.7 for ruby-head)
patch is required (for 1.8 rubies and some ruby-head's).
To install rbx and/or Ruby 1.9 head (MRI) (eg. 1.9.2-head), then you
must install and use rvm 1.8.7 first.
Additional Dependencies:
# For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following:
ruby: /usr/bin/apt-get install build-essential openssl libreadline6
libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev
libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf
libc6-dev ncurses-dev automake libtool bison subversion pkg-config
# For JRuby, install the following:
jruby: /usr/bin/apt-get install curl g++ openjdk-6-jre-headless
jruby-head: /usr/bin/apt-get install ant openjdk-6-jdk
# For IronRuby, install the following:
ironruby: /usr/bin/apt-get install curl mono-2.0-devel
Why does RVM, Ruby or Rails need libc6-dev, ncurses-dev and libtool ?
For the other packages, as far as i can make out:
build-essential automake bison autoconf pkg-config is useful for compiling from source
libreadline6 libreadline6-dev is needed for irb's readline support
openssl libssl-dev is required for ruby's SSL support
curl git-core subversion is required for fetching software
zlib1g zlib1g-dev is required for unpacking rubygems
libyaml-dev is required for ruby's YAML support
libsqlite3-dev sqlite3 is required for sqlite support for rails
libxml2-dev libxslt-dev is required for parsing XML via nokogiri
Want to know why RVM added them in the first place?
What well known libraries will break if any of these packages are not installed?
Which of these packages are necessary for ruby itself to be installed and which of them are needed for a stdlib ie. yaml or rexml ?
EDIT: forgot pkg-config
EDIT: added some more questions at the end

ruby comes with a set of extensions, some of them require additional packages, for example ncurses is needed for better console support (irb) - but is not required, pkg-config is needed for packages searching - most packages expose a configuration file which helps in finding proper paths for compilation ... and so on, here is list of all extensions: https://github.com/ruby/ruby/tree/trunk/ext ... although it's not the list of requirements - i can not find official ruby list of requirements.

libc6-dev are the C standard library development files. It's very unlikely that any useful C code would compile without them. As Ruby is written in C, those are needed to compile and build ruby itself.
I would guess that ncurses is needed to compile irb.
I would agree with the purpose of the other packages you mention.

These are all basic libraries which are dependencies for various gems you will use in future.
build-essential openssl libreadline6
libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev
libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev
autoconf libc6-dev ncurses-dev automake libtool bison subversion
There may be a case like you will not require all the libraries in you m/c, though when you will install some gems, errors like
cannot build native extension
In those cases the required libraries are looked upon for the failed gem and installed. Libraries are installed only once and are totally different as compared to gems. The libraries present here are for
Git, mysql server, sqlite, curl etc.
I would suggest to install it in the beginning with sudo permissions using Sudo apt-get install. Hope this helps. Also as you try out new gems and plugins, you would be installing new libraries in future.

Related

RVM Ruby on Rails installation

I'm having a trouble installing rvm ROR on my machine using ubuntu 12.04
here are the outputs I'm getting:
Output #1:
Searching for binary rubies, this might take some time.
No binary rubies available for: ubuntu/12.04/i386/ruby-1.8.7-p371.Continuing with compilation.
Please read 'rvm mount' to get more information on binary rubies.
Installing requirements for ubuntu, might require sudo password.
and at the end of the line of update I get this:
Output #2:
There has been error while updating 'apt-get', please give it some time and try again later.
For 404 errors check your sources configured in:
/etc/apt/sources.list
/etc/apt/sources.list.d/*.list
Try running sudo apt-get update separately on a command line. Your Ubuntu might be old and its repositories could be out of date. So apt-get update itself is maybe not working in your machine.
To step over that issue, run the following commands:
# Disable RVM from trying to install necessary software via apt-get
rvm autolibs disable
# Then try installing Ruby:
rvm install 1.8.7
If you still face errors, see if you can directly do apt-get install without doing apt-get update (which fails):
# Try to see if you can manually install the necessary software
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config
If that's also not working, then paste your apt-get update output.

Error While installing Ruby

I have used this procedure.I m using Linux Mint.
I am getting the following error while installing.
E: Unable to locate package libreadline6-dev
E: Unable to locate package libyaml-dev
E: Unable to locate package libgdbm-dev
E: Package 'ncurses-dev' has no installation candidate
E: Package 'bison' has no installation candidate
E: Package 'subversion' has no installation candidate
E: Package 'libffi-dev' has no installation candidate
I think you didn't installed the rvm requirements .
Install the requirements like libreadline6-dev , libyaml-dev , libgdbm-dev ,etc..
I think This will solve the Problem.
Install all these with the command
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev \
curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 \
libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison \
subversion pkg-config
Or, Just refer this link.
This instructions are old, following rvm installation instructions:
\curl -#L https://get.rvm.io | bash -s stable --autolibs=4 --ruby
It will:
Download and install RVM
Enable automatic requirements installation
Install ruby including all required dependencies
which OS you using ?
if you using Ubuntu,
then use the link :
http://blog.sudobits.com/2012/05/02/how-to-install-ruby-on-rails-in-ubuntu-12-04-lts/
if you are using windows
then problem while installing in some gem dependence like. 'libffi-dev', less-rail
than used other OS that very well for "Ruby on Rails" like Linux/Ubuntu
If you're using ubuntu, the copy and paste https://github.com/vaneyckt/Ruby-on-Rails-installation-script/blob/master/install.sh. You might need to hit enter at some point.
this worked for me.
WARNING: The following packages cannot be authenticated!
apt-get clean # Remove cached packages
cd /var/lib/apt
mv lists lists.old # Backup mirror info
mkdir -p lists/partial # Recreate directory structure
apt-get clean
apt-get update # Fetch mirror info

Trouble installing ruby on rails

I'm getting
ERROR: While executing gem ... (NameError) uninitialized constant Gem::RemoteFetcher::OpenSSL
When I try to run # gem install rails
I already have
Ruby v1.8.7
Gem (rubygems.nonarch) v1.7.2
Installed.
Any Idea what I should do?
Running sudo gem install rails now gives me:
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/json-1.7.4 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/json-1.7.4/ext/json/ext/generator/gem_make.out
Everything Installed via YUM
Running Fedora 15
I was having a similar issue while doing #gem install rake, but I found out that my system was behind a proxy server, and so I tried supplying the proxy address by this command:
gem install rake -p http//IPaddress:proxyport (put : after http)
and it worked for me, with no such error afterwards.
Hit rvm requirements. You don't have libssl-dev installed.
➜ ~ rvm requirements
Requirements for Linux ( DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.10
DISTRIB_CODENAME=maverick
DISTRIB_DESCRIPTION="Ubuntu 10.10" )
NOTE: 'ruby' represents Matz's Ruby Interpreter (MRI) (1.8.X, 1.9.X)
This is the *original* / standard Ruby Language Interpreter
'ree' represents Ruby Enterprise Edition
'rbx' represents Rubinius
bash >= 4.1 required
curl is required
git is required (>= 1.7 for ruby-head)
patch is required (for 1.8 rubies and some ruby-head's).
To install rbx and/or Ruby 1.9 head (MRI) (eg. 1.9.2-head),
then you must install and use rvm 1.8.7 first.
Additional Dependencies:
# For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following:
ruby: /usr/bin/apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
# For JRuby, install the following:
jruby: /usr/bin/apt-get install curl g++ openjdk-6-jre-headless
jruby-head: /usr/bin/apt-get install ant openjdk-6-jdk
# For IronRuby, install the following:
ironruby: /usr/bin/apt-get install curl mono-2.0-devel
I'm not aware how Fedora's requirements differ from Ubuntu's, but that's probably only in package names.
I have just had same issue with gem install on Ubuntu. It is now working and I think that what I did to fix it was enable ssl out through the firewall.
It looks as if gem returns this error in response to failure to establish an SSL connection, presumably while trying to handle the failure.
Russell

Not able to run gem command and build ruby with zlib support

I didn't know that installing ruby is such a pain
After lot of trouble with curl certificate, I installed the rvm using the methods mentioned in the rvm site also with lot of help from stackoverflow questions.
Now I am trying to install rails using the gems command
gem install rails
but I always get this error
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
I did follow every thing mentioned here https://rvm.beginrescueend.com/packages/zlib/
and also as a mentioned in a stackoverflow post
I did install all the tools as required by the requirements
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel
But still I get this error. When I looked at the build log for ruby under
/usr/local/rvm/log/ruby-1.9.3-p125/configure.log
I see this error
[2012-04-07 01:13:44] ./configure --prefix=/usr/local/rvm/rubies/ruby-1.9.3-p125 --enable-shared --disable-install-doc --with-zlib --with-opt-dir=/usr/local/rvm/usr --with-libyaml
configure: WARNING: unrecognized options: --with-zlib, --with-libyaml
Is the rvm broken ? or is there a problem while building the ruby src.
Note: I am running fedora 14
RVM causes more problems than it solves (IMHO). Better tools are ruby-build and rb-env. Newer tools that look very good too are ruby-install and chruby.
Here are my notes from my recent Red Hat Enterprise Linux (RHEL) installation of Ruby, which I believe is pretty similar to Fedora. Perhaps these notes can be of some help to you. Ask me questions if you like.
Install zlib
yum install zlib zlib-devel
Install YAML
export k=yaml v=0.1.4
wget http://pyyaml.org/download/libyaml/$k-$v.tar.gz
tar zxvf $k-$v.tar.gz
cd $k-$v
./configure
make && make install
Install X11 if you want X or headless browsing for testing
yum install
xorg-x11-fonts-misc
xorg-x11-fonts-truetype
xorg-x11-server-Xorg
xorg-x11-server-Xvfb
Install libraries
yum install
gdbm gdbm-devel
ncurses ncurses-devel
openssl openssl-devel
readline readline-devel
tk tk-devel
libjpeg libjpeg-devel
libpng libpng-devel
libxml2 libxml2-devel
libxslt libxslt-devel
zlib zlib-devel
Install ruby-build
cd /opt
git clone git://github.com/sstephenson/ruby-build.git
cd ruby-build/
./install.sh
Install Ruby
export k=ruby v=1.9.3-p125
wget http://ftp.ruby-lang.org/pub/ruby/1.9/$k-$v.tar.gz
tar zxvf $k-$v.tar.gz
cd $k-$v
# Either onfigure with defaults...
./configure
# Or configure with custom locations...
./configure --prefix=/opt/$k/$v --enable-shared --with-opt-dir=/opt/yaml/current
make && make check && make install
Environment
Edit /etc/environment to add this:
RUBYOPT='-r rubygems -r psych'
If you put Ruby in a custom directory, also merge this with your existing path:
PATH=/opt/ruby/1.9.3-p125/bin (or wherever you put it)
Load environment:
source /etc/environment
Verify gem runs and you see the intial set of gems:
gem list
Gem update:
gem update --system

How do I install Ruby with libyaml on Ubuntu 11.10?

I installed ruby-1.9.3-p0 on my Ubuntu 11.10 wubi and then rubygems to get Rails set up.
This is my code:
sudo ruby setup.rb
I got this error:
"/usr/local/lib/ruby/1.9.1/yaml.rb:56:in'<top(required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby."
I installed libyaml and reinstalled Ruby but still it doesn't work.
The information changed and I have no idea what's wrong with it.
You must install the paquage libyaml-dev before installing ruby, if not you can still use extconf.rb for the missing library. So for this problem you can do (from the ruby install folder) :
cd ext/psych
ruby extconf.rb
make
make install
Extconf.rb is usefull for adding a library after have installed ruby.
Do the following:
you must have "curl" installed :sudo apt-get install curl
Go To this link RVM
Copy the command in the quick install box and Paste it in your command prompt
Type echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
Type ~/.bashrc
Type the following code:
sudo apt-get install build-essential libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
Type: rvm install 1.9.3-p0
Type: rvm use 1.9.3-p0
Type: gem install rails
Have fun :)
Ok, after a failed attempt at installing RoR on my Ubuntu 11.10 box, I combined the tips from this page and from this resource: http://www.thegeekwork.com/how-to-install-ruby-on-rails-in-ubuntu-11-10/
This is the breakdown, step-by-step of what I just did to make this work (sorry if I didn't format this so great, I was just trying to keep it neat):
1) Fresh install of Ubuntu 11.10
2) me#Box:~$ sudo apt-get install curl
3) me#Box:~$ sudo apt-get install git
4) me#Box:~$ sudo apt-get update
5) me#Box:~$ sudo apt-get dist-update
6) me#Box:~$ sudo shutdown -r now
7) me#Box:~$ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
8) me#Box:~$ gedit ~/.bashrc
9) add the following line to the end (and save the file)
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
10) me#Box:~$ source ~/.bashrc
11) me#Box:~$ type rvm | head -1
After executing above command you should be getting this output -
rvm is a function
You’ve successfully installed the RVM. Next, you are supposed to install additional dependencies. To find out those programs type -
12) me#Box:~$ rvm requirements
After the above command, install the additional packages recommended by RVM -
13) me#Box:~$ sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
14) me#Box:~$ rvm install 1.9.2
(#14 takes a little while)
15) me#Box:~$ rvm use 1.9.2
(This selects the version you want to use)
(If you aren’t sure about the ruby version currently being used, then type -
ruby -v)
16) me#Box:~$ gem install rails
(this will take a little while...)
17) Make a sample application as a test...
me#Box:~$ rails new test_app
me#Box:~$ cd test_app
me#Box:~/test_app$ rails server
AND THAT"S WHERE THIS THING DIDN"T WORK. ARRRRRRRRRrrrrrrrrrrrrrgh.
So,
18) in your application folder ("test_app"), open Gemfile and uncomment "therubyracer" line
19) me#Box:~/test_app$ bundle install
20) me#Box:~/test_app$ rails server
Done, and done.
I don't understand why it set 0.0.0.0:3000 as the host address (I thought it would be 127.0.0.1), but quite frankly, that's not bothering me right now -- I got it to work (so far). Time to get going with some Rails! :D
I hope this helps anyone else who is looking to make this work! :)
Note: I realize that #13 repeats some of the things I already installed, but I don't care, I'm just doing what the thing says. :/
Note2: Holy learning curve on just posting an answer! I wasn't sure what was considered "code" and apparently the prompt is considered code. Makes sense now :)
Note3: This is my first "Answer" on StackOverflow! :D
If you are compiling ruby you might need libyaml-dev
Debian (and Ubuntu, etc.) packages that contain the files needed to install some other program from source usually end in -dev, e.g. libyaml-dev, so try installing that. Or just use rvm, it will actually install this for you.
Compling yaml from its source will make it work. I am running the same config as yours. I followed this http://collectiveidea.com/blog/archives/2011/10/31/install-ruby-193-with-libyaml-on-centos/. It definitely works.

Resources