I’m in the process of installing Ruby on Rails on a VPS running CentOS 5.1 and run into an issue with gem complaining for the missing zlib library. What happened was that I first used “sudo yum install ruby” to install the ruby runtime. However, the pre-packaged ruby in the Yum repository was older, 1.8.5. I only found out about this when I tried to run the mongrel_cluster to set up the mongrel instances. Mongrel was complaining about the older version of Ruby and the need for the fcgi fix. I decided to uninstall the yum ruby package and compile the newer version of Ruby from the source.
I compiled and installed Ruby 1.8.6 from the tar ball source first (./configure, make, make install), then I removed the pre-installed package using “sudo yum remove ruby” and removed all the dependencies with it. Next I installed gem 1.1.1 from the source (ruby setup.rb). I proceeded to install rails 2.0.2 again (”sudo gem install rails -y”). Bam, gem started to complain:
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- zlib (LoadError)
Not good!
I did some research and it turned out that my CentOS 5.1 VPS is a barebone box, it did have the extra development libraries installed. Hence when I compiled Ruby from source, make did not compile the zlib extension because I did not have the zlib-devel package installed.
After installing zlib-devel package through yum (”sudo yum install zlib-devel”), I cd’ed into my Ruby source folder and into the ext/zlib folder (in my case, ruby-1.8.6-p114/ext/zlib/). Then I proceeded to install the zlib library (”ruby extconf.rb”, “make”, “make install”). Afterwards, gem was working fine again! Yay!
Trying your steps - I get errors when I do make in the ext/zlib library
Something about /usr/loca/lib/libz.a (adler32.o) relocate R_X86_64_32 agaisnt ‘a local symbol’ cannot be used. Recompile with the -fPIC
Tried the CCFLAGS=-fPIC and didn’t make a difference
I’m on slicehost. Any ideas?
Ta
Lal