Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ubuntu rails install fails on zlib

If you come across this question trying to install Ruby using Ruby Version Manager (RVM) on Ubuntu 10.04 then there are instructions on installing zlib on the rvm web site http://rvm.beginrescueend.com/packages/zlib/

The steps are:

rvm pkg install zlib

(or rvm package install zlib if you get "ERROR: Unrecognized command line argument: 'pkg'" - older versions of rvm used the verb 'package' instead)

then

rvm remove 1.9.1
rvm install 1.9.1

I am using Ubuntu 10.04 (Lucid), i wanted to install ruby 1.9.2 because 1.9.1 is not recommended with Rails. So I downloaded the source for 1.9.2 and unzipped/unarchived it. my source distro is ruby-1.9.2-p0. After I unpacked it, I built zlib as follows:

cd ruby-1.9.2-p0/ext/zlib
ruby extconf.rb
make
sudo make install
sudo gem install rails

that fixed the problem. This is similar to what other people posted above, but not exactly, so I figured I may as well post exactly what I did to get it going.


I have the same problem in CentOS and fix it by executing the following command:

First, I ensure that zlib and zlib-devel exist (like many suggested above).

yum install zlib zlib-devel

Second, I recompiled and installed the sources of zlib that comes with ruby.

cd /home/myname/installers/ruby-1.8.7-p174/ext/zlib/
ruby extconf.rb --with-zlib-include=/usr/include --with-zlib-lib=/usr/lib
make
make install

That commands seem to fix the problem, then I execute gem update --system and the error with zlib vanished. Then I install rails with gem install rails. Note to mention I had installed gem before, and after recompile and install zlib, I don't recompile neither install gem (actually I don't knew how uninstall it because I don't found a script to do that)

That works for me...hope to you to.

Regards.


try

aptitude install zlib1g-dev

Then go about your business.


I really didn't like any of these answers ... none really focused on the users actual needs and question ... just people telling what they did ... no context and it didn't even work for me ...

So, ..

I'm installing a new box Ubuntu 8.04 LTS 64-bit ...

So, I ...

cd ~  
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz  
tar -xvvf ruby-1.9.2-p180.tar.gz  
cd ruby-*  
./configure  
make  
install  
sudo make install  

And then I have this problem with ...

gem list

it doesn't work ... something about zLib not found crap ...

So, I actually READ the README and find that I need to edit a file ...

[my ruby source directory]/ext/Setup

and UN-COMMENT the line with zLib in it ... by removing the "#" in the first column

Then I run the commands again ... included here for reference ...

./configure
make  
install  
sudo make install  

and all is well ... it's logical ... and is devoid of "rvm" and other ... "just install more stuff to make it work" type solutions.

Joet