I just installed 1.9.1 onto Mandriva 2009 (Linux version 220.127.116.11-desktop-1mnb (email@example.com) (gcc version 4.3.2 (GCC) ))
Ran: gem install rails
And this is what I got:
[root@tango ruby-1.9.1-p0]# gem install rails
require': no such file to load -- zlib (LoadError) from /usr/local/lib/ruby/1.9.1/rubygems/package.rb:10:in <top (required)>'
require' from /usr/local/lib/ruby/1.9.1/rubygems/format.rb:9:in <top (required)>'
require' from /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:11:in <top (required)>'
require' from /usr/local/lib/ruby/1.9.1/rubygems/dependency_installer.rb:3:in <top (required)>'
require' from /usr/local/lib/ruby/1.9.1/rubygems/commands/install_command.rb:4:in <top (required)>'
require' from /usr/local/lib/ruby/1.9.1/rubygems/command_manager.rb:140:in rescue in load_and_instantiate'
load_and_instantiate' from /usr/local/lib/ruby/1.9.1/rubygems/command_manager.rb:65:in '
find_command' from /usr/local/lib/ruby/1.9.1/rubygems/command_manager.rb:104:in process_args'
run' from /usr/local/lib/ruby/1.9.1/rubygems/gem_runner.rb:39:in run'
from /usr/local/bin/gem:24:in `'
Updated by nobu (Nobuyoshi Nakada) over 13 years ago
At Sat, 14 Feb 2009 15:44:44 +0900,
Fred Obermann wrote in [ruby-core:22059]:
By the way, zlib is installed on the machine, details as follows:
Currently installed version: 1.2.3-12mdv2009.0
You need the package for development too.
Updated by mwlang (Michael Lang) over 13 years ago
I encountered the same error when installing to a fresh copy of Ubuntu 8.10 Intrepid Ibex. Turned out ext/zlib has extconf.rb which means its make files get generated from calling "ruby extconf.rb"
Since there was no ruby interpreter installed, the extconf.rb files couldn't be executed. Solution:
sudo make install
sudo make install
Updated by lmueller (Lutz Mueller) over 13 years ago
my apologies if this is obvious, but I struggled with the same problem.
gem update fails in a similar manner.
I downloaded the zlib sources from www.zlib.net, went through configure/make/make install.
I then went back to the ruby 1.9.1 source directory and also repeated the configure/make/make install.
Afterwards, I was able to do a "gem update" and a "gem install rails".
I am posting this here because this happened to be the first place I hit in search for a solution.
FWIW, Michael Lang's solution (above) did not work for me.
I am running Ubuntu 8.10 Intrepid.
Updated by Radar (Ryan Bigg) over 12 years ago
I too have encountered this issue with a completely bare-bones installation of Ruby 1.9.1-p243.
To fix it, I followed Lutz steps about downloading and compiling zlib and then I cd'd into the /ext/zlib directory, ran ruby extconf.rb && make && sudo make install then "sudo gem install rails" worked. I feel that going through the whole Ruby ./configure && make && sudo make install process is excessive.
Updated by weigui (wei gui) about 11 years ago
The error is due to zlib1g-dev is not installed by default. In ubuntu, to solve it:
- sudo apt-get install zlib1g-dev # to install the dependent zlib
- cd /ext/zlib # go to ext/zlib in ruby source directory
- ruby extconf.rb
- make # to generate zlib.so
- make install