Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RVM Ruby 1.9.1 install can't locate zlib but its runtime and dev library are there

Trying to get Ruby 1.9.1 up and running with RVM on a fresh install (fedora).

After doing rvm install 1.9.1, the rubygems error logs show that zlib can't be located

no such file to load -- zlib (LoadError)

However both the zlib runtime and development libraries are installed and up-to-date.

I'm kinda stumped on this one at the moment.

like image 852
Casper Avatar asked Mar 14 '10 04:03

Casper


2 Answers

Use rvm to install zlib

https://rvm.io/packages/zlib/

rvm package install zlib rvm remove 1.9.1 rvm install 1.9.1 -C --with-zlib-dir=$rvm_path/usr 

Edit: The rvm package command was renamed to rvm pkg in v1.6.25.

like image 69
JasonOng Avatar answered Oct 18 '22 18:10

JasonOng


You need to install zlib before compiling/installing Ruby. If you didn't do this, make sure to remove everything related to Ruby 1.9.1 from your ~/.rvm folder (so that it will be build from scratch).

Install zlib using your favorite package manager:

sudo apt-get install zlib1g-dev 

You might also want to install the following packages as they are required by tools like OpenSSL,
Nokogiri, IRB or SQLite:

 libssl-dev libreadline6-dev libxml2-dev libsqlite3-dev 

Then install Ruby 1.9.1 again (nowadays I would suggest to use a newer version):

rvm install 1.9.1 

Watch for "compiling ...". This should take a while. If it doesn't, then Ruby 1.9.1 might still be cached
in your ~/.rvm folder.

like image 42
rubiii Avatar answered Oct 18 '22 20:10

rubiii