Rvm / gem install not working (zlib issue) on ubuntu

Hi

gem install is not working under rvm on my ubuntu 10.04 system. The
error is related to zlib.

Note I have followed instructions on stackoverflow related to this and
still come up short.

$ gem install redcar

ERROR: Loading command: install (LoadError)
cannot load such file – zlib
ERROR: While executing gem … (NameError)
uninitialized constant Gem::Commands::InstallCommand

Here is output for zlib on my system

steve@mithril:/shared/hbase$ dpkg -s zlib*
Package `zlib*’ is not installed and no info is available.
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their contents.
steve@mithril:/shared/hbase$ dpkg-query -l zlib*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description
++±======================-======================-============================================================
un zlib1 (no description
available)
un zlib1-dev (no description
available)
ii zlib1g 1:1.2.3.3.dfsg-15ubunt compression library -
runtime
ii zlib1g-dev 1:1.2.3.3.dfsg-15ubunt compression library -
development

I am posting here instead of Stackoverflow because posting messages
stopped working for me on SOF, both on FF and in Chrome

Hopefully here this error will be familiar to many and can be answered

have you installed your rvm AFTER you install the zlib?

Hi Hans,
No, I installed rvm first. Not sure why that should matter, but in any
case I have reinstalled rvm . No change.

root@mithril:/etc# bash -s stable < <(curl -s
https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
Downloading RVM from wayneeseguin branch stable
% Total % Received % Xferd Average Speed Time Time Time
Current
Dload Upload Total Spent Left
Speed
100 938k 100 938k 0 0 385k 0 0:00:02 0:00:02 --:–:–
600k

Upgrading the RVM installation in /usr/local/rvm/
RVM system user group ‘rvm’ exists, proceeding with installation.

Upgrade Notes:

  • No new notes to display.

<snip …>

Upgrade of RVM in /usr/local/rvm/ is complete.

root,

Thank you for using RVM!

I sincerely hope that RVM helps to make your life easier and more

enjoyable!!!

~Wayne

rvm 1.10.3 (stable) by Wayne E. Seguin [email protected], Michal
Papis [email protected] [https://rvm.beginrescueend.com/]

root@mithril:/etc# rvm reload
RVM reloaded!

root@mithril:/etc# 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
Reading package lists… Done
Building dependency tree
Reading state information… Done
build-essential is already the newest version.
openssl is already the newest version.
libreadline6 is already the newest version.
libreadline6-dev is already the newest version.
curl is already the newest version.
git-core is already the newest version.
zlib1g is already the newest version.
zlib1g-dev is already the newest version.
libssl-dev is already the newest version.
libyaml-dev is already the newest version.
libsqlite3-dev is already the newest version.
sqlite3 is already the newest version.
libxml2-dev is already the newest version.
Note, selecting libxslt1-dev instead of libxslt-dev
libxslt1-dev is already the newest version.
autoconf is already the newest version.
libc6-dev is already the newest version.
Note, selecting libncurses5-dev instead of ncurses-dev
libncurses5-dev is already the newest version.
automake is already the newest version.
automake set to manually installed.
libtool is already the newest version.
bison is already the newest version.
subversion is already the newest version.
The following packages were automatically installed and are no longer
required:
linux-headers-2.6.32-33 linux-headers-2.6.32-38
linux-headers-2.6.32-38-generic
linux-headers-2.6.32-33-generic
Use ‘apt-get autoremove’ to remove them.
0 upgraded, 0 newly installed, 0 to remove and 11 not upgraded.

root@mithril:/etc# rvm list

rvm rubies

ruby-1.9.2-p318 [ x86_64 ]
=* ruby-1.9.3-p125 [ x86_64 ]

=> - current

=* - current && default

* - default

root@mithril:/etc# gem install redcar
ERROR: Loading command: install (LoadError)
cannot load such file – zlib
ERROR: While executing gem … (NameError)
uninitialized constant Gem::Commands::InstallCommand
root@mithril:/etc# rvm requirements

i think this is your solution: http://beginrescueend.com/packages/zlib/

Hans M. wrote in post #1053055:

i think this is your solution: http://beginrescueend.com/packages/zlib/

Hi Hans,
I had already gone through that page and the proposed solutions before,
including reinstalling rvm. Unfortunately they do not work.

Stephen B. wrote in post #1053059:

Hans M. wrote in post #1053055:

i think this is your solution: http://beginrescueend.com/packages/zlib/

Hi Hans,
I had already gone through that page and the proposed solutions before,
including reinstalling rvm. Unfortunately they do not work.

Just to be sure, i have followed those directions for the third time.
Still fails. This is extremely frustrating.

root@mithril:~# rvm pkg install zlib
Fetching zlib-1.2.6.tar.gz to /usr/local/rvm/archives
% Total % Received % Xferd Average Speed Time Time Time
Current
Dload Upload Total Spent Left
Speed
100 544k 100 544k 0 0 242k 0 0:00:02 0:00:02 --:–:–
315k
Extracting zlib-1.2.6.tar.gz to /usr/local/rvm/src
Configuring zlib in /usr/local/rvm/src/zlib-1.2.6.
Compiling zlib in /usr/local/rvm/src/zlib-1.2.6.
Installing zlib to /usr/local/rvm/usr
root@mithril:~# rvm reinstall 1.9.3 --with-zlib-dir=$rvm_path/usr
Removing /usr/local/rvm/src/ruby-1.9.3-p125…
Removing /usr/local/rvm/rubies/ruby-1.9.3-p125…
Removing default ruby interpreter
Removing ruby-1.9.3-p125 aliases…
Removing ruby-1.9.3-p125 wrappers…
Removing ruby-1.9.3-p125 environments…
Removing ruby-1.9.3-p125 binaries…
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.9.3-p125,
this may take a while depending on your cpu(s)…

ruby-1.9.3-p125 - #fetching
ruby-1.9.3-p125 - #extracting ruby-1.9.3-p125 to
/usr/local/rvm/src/ruby-1.9.3-p125
ruby-1.9.3-p125 - #extracted to /usr/local/rvm/src/ruby-1.9.3-p125
Applying patch ‘xcode-debugopt-fix-r34840’ (located at
/usr/local/rvm/patches/ruby/1.9.3/p125/xcode-debugopt-fix-r34840.diff)
ruby-1.9.3-p125 - #autoreconf
ruby-1.9.3-p125 - #configuring
ruby-1.9.3-p125 - #compiling
ruby-1.9.3-p125 - #installing
Retrieving rubygems-1.8.21
% Total % Received % Xferd Average Speed Time Time Time
Current
Dload Upload Total Spent Left
Speed
100 250k 100 250k 0 0 325k 0 --:–:-- --:–:-- --:–:–
769k
Extracting rubygems-1.8.21 …
Removing old Rubygems files…
Installing rubygems-1.8.21 for ruby-1.9.3-p125 …
Installation of rubygems completed successfully.
ruby-1.9.3-p125 - adjusting #shebangs for (gem irb erb ri rdoc testrb
rake).
ruby-1.9.3-p125 - #importing default gemsets (/usr/local/rvm/gemsets/)
Install of ruby-1.9.3-p125 - #complete
root@mithril:~# rvm list

rvm rubies

ruby-1.9.2-p318 [ x86_64 ]
=> ruby-1.9.3-p125 [ x86_64 ]

Default ruby not set. Try ‘rvm alias create default ’.

=> - current

=* - current && default

* - default

root@mithril:~# rvm alias create default 1.9.3
Creating alias default for ruby-1.9.3-p125.
Recording alias default for ruby-1.9.3-p125.
Creating default links/files
root@mithril:~# gem install redcar
ERROR: Loading command: install (LoadError)
cannot load such file – zlib
ERROR: While executing gem … (NameError)
uninitialized constant Gem::Commands::InstallCommand

I found that I had two “extra” rubies that weren’t getting uninstalled.
When I made sure I had NO rubies installed, then ran the

rvm pkg install zlib
rvm install 1.9.3

and gem installs started working

The solution was buried in the install log: the X11 libraries were not
found. That was a surprise: this window (chrome …) is running on the
machine along with a bunch of other gui apps… i guess there are
additional libraries required for development.

Use ActiveTcl libraries (if available).
Search tclConfig.sh and tkConfig.sh…
Fail to find [tclConfig.sh, tkConfig.sh]
Use X11 libraries (or use TK_XINCLUDES/TK_XLIBSW information on
tkConfig.sh).
Warning:: cannot find X11 library. tcltklib will not be compiled
(tcltklib is disabled on your Ruby. That is, Ruby/Tk will not work).
Please check configure options. If your Tcl/Tk don’t require X11, please
try --without-X11.
Can’t find X11 libraries.
So, can’t make tcltklib.so which is required by Ruby/Tk.
Failed to configure tk. It will not be installed.
configuring tk/tkutil
Failed to configure tk/tkutil. It will not be installed.
configuring win32ole
Failed to configure win32ole. It will not be installed.
configuring zlib
Failed to configure zlib. It will not be installed.

On Sat, Mar 24, 2012 at 2:02 PM, Stephen B. [email protected]
wrote:

Hi Hans,
I had already gone through that page and the proposed solutions before,
including reinstalling rvm. Unfortunately they do not work.

Just to be sure, i have followed those directions for the third time.
Still fails. This is extremely frustrating.

One question. When you reinstall rvm, does it delete the installed
Rubies? I mean, do you then have to reinstall 1.9.2 and 1.9.3? I ask
because this recently happened to a colleague, and the problem was
that zlib needs to be in your system before compiling Ruby.

Jesus.