Put your message here! Contact me for more information
 
 








 

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!


 

3 Responses to “Ruby 1.8.6 and Gem 1.1.1 error: gem_original_require for zlib



12:27 am
June 3, 2008
#163896

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




9:38 am
June 3, 2008
#164078

Brendan, from what you’re describing, probably it’s because the library files were not “linked” correctly in to the lib folder. I’m still relatively new to the Linux’s installation process, but from my understanding, the source is compiled into the “prefix folder”, then the compiled binary is sym link to a generic “.o” file in /usr/lib (or other library folder). The “ld” command is used to configure this registration.

I ran into an issue, which I think is similar to yours, while installing Memcached, check out the post here

http://alexle.net/archives/275

Cheers!

PS: I’m also on Slicehost!




12:35 pm
June 11, 2008
#167756

Alex

Yah - that makes sense. Think I tried ‘ldd’ but didn’t c anything obvious.
I’ve reswitched over 2 Ubuntu as Thin/Ramaze works fine under there.
Will hop back to Centos once it (someone else) gets fixed
Its only a 64 bit issue as I’ve it working fine on a 32bit Centos 5.1 system.

Thanks 4 the help
Lal




 

Leave a Reply