Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zlib keeps causing problems in new ubuntu server/rvm/gemset

Tags:

ruby

zlib

rvm

I've just installed RVM on a new ubuntu 10.04 LTS server and one ruby, 1.9.2-p180. I've made a new gemset in my project folder, which has a Gemfile. I realised that in order to install the gems in the gemfile, i need to install bundler, so i did

gem install bundler

but, i get this error:

ERROR:  Loading command: install (LoadError)
  no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
  uninitialized constant Gem::Commands::InstallCommand

I googled around a bit and tried this:

rvm pkg install zlib

which installed ok but didn't solve the problem. I also tried installing the rake gem but got the same error trying to do that.

Kind of stuck...any suggestions? thanks, max

EDIT - btw, i can install the bundler gem fine outside of rvm, ie using system ruby.

EDIT2 - I got past this problem by removing the version of ruby, then installing it again with zlib:

rvm remove 1.9.2-p180
rvm install 1.9.2-p180 -C --with-zlib-dir=$rvm_path/usr

Now i can install bundler and all my gems ok. Hooray. Except, when i try to open my rails env (with rails s, rails c or rake db:create) i get this fatal error:

/home/max/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/
1.9.1/rubygems/custom_require.rb:36:in `require': 
/lib/libz.so.1: version `ZLIB_1.2.3.3' not found (required by 
/home/max/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/i686-linux/zlib.so) - 
/home/max/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/i686-linux/zlib.so (LoadError)

So, still not out of the woods zlib-wise. I don't know why zlib is causing such problems, any ideas?

like image 753
Max Williams Avatar asked Dec 04 '25 18:12

Max Williams


1 Answers

Sorted it!

Running locate libz gives me

/home/max/.rvm/src/zlib-1.2.5/libz.a
/home/max/.rvm/src/zlib-1.2.5/libz.so
/home/max/.rvm/src/zlib-1.2.5/libz.so.1
/home/max/.rvm/src/zlib-1.2.5/libz.so.1.2.5
/home/max/.rvm/usr/lib/libz.a
/home/max/.rvm/usr/lib/libz.so
/home/max/.rvm/usr/lib/libz.so.1
/home/max/.rvm/usr/lib/libz.so.1.2.5
/lib/libz.so.1
/lib/libz.so.1.2.3.3

I just noticed that the version of libz in lib is 1.2.3.3 while the version i installed with rvm is 1.2.5. Is this the problem perhaps? In the /lib folder, zlib.so.1 is symlinked to it's neighbour file libz.so.1.2.3.3.

I tried symlinking it to /home/max/.rvm/usr/lib/libz.so.1.2.5 instead:

sudo rm /lib/libz.so.1
sudo ln -s /home/max/.rvm/src/zlib-1.2.5/libz.so.1 /lib/libz.so.1

and, that seems to have worked... i still don't really understand exactly what went wrong, though, so would welcome a more insightful solution/explanation :)

like image 175
Max Williams Avatar answered Dec 06 '25 08:12

Max Williams



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!