Gems zlib problem

I am going to echo posts scattered throughout the Internet here and say
I cannot get Ruby gems working due to lack of zlib. Trying to install a
package like Rails gives the error:

/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require__':\
no such file to load -- zlib (LoadError)

I am sure you guys have had this question many times before but your
search engine is broken ("Application Error (Rails)") so I can't check
the archive.

I am on Ubunutu Warty and have tried installing every package under the
sun via apt, anything with zlib or ziplib in the name. I can't install
ruby via apt because rails wants 1.8.4, not packaged.

···

--
Posted via http://www.ruby-forum.com/.

This is what worked for me.
Remove all the ruby packages using synaptic: ALL of them
You need to install zlibc, zlib1g, zlib1g-dev, then recompile ruby.
e.g. sudo apt-get install zlibc etc.
THen install ruby-1.8.4 from source
Then download rubygems and install it.

Thanks, I'll give this a shot. I did install all three of those (zlibc,
zlib1g, zlib1g-dev) previously and recompiled ruby184 after to no avail.
However, I'm not sure that I removed ALL ruby packages first, so I will
try that.

···

--
Posted via http://www.ruby-forum.com/.

mlbright@gmail.com wrote:

This is what worked for me.
Remove all the ruby packages using synaptic: ALL of them
You need to install zlibc, zlib1g, zlib1g-dev, then recompile ruby.
e.g. sudo apt-get install zlibc etc.
THen install ruby-1.8.4 from source
Then download rubygems and install it.

Yikes! Makes me glad I run FreeBSD :slight_smile:

No dice. Here's the relevant section from make, which appears to be
unable to find zlib:

compiling zlib
make[1]: Entering directory `/root/ruby-1.8.4/ext/zlib'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/root/ruby-1.8.4/ext/zlib'
making ruby

From what I can tell, zlib lives at

/usr/lib/
libz.so
libz.so.1
libz.so.1.2.1.1
libzzip-0.so.10
libzzip-0.so.10.0.82
libzzip.a
libzzip.la
libzzip.so

as well as

/lib/uncompress.o

usr/include/zconf.h
usr/include/zlib.h

... but it appears ruby's make isn't seeing any of that. I am going to
check the rubygems docs (sparse IIRC).

rt

···

--
Posted via http://www.ruby-forum.com/.

Did you re-run configure?

If configure didn't find zlib the first time it won't check if you just run 'make'.

···

On Jan 26, 2006, at 4:48 PM, Ryan Tate wrote:

Thanks, I'll give this a shot. I did install all three of those (zlibc,
zlib1g, zlib1g-dev) previously and recompiled ruby184 after to no avail.
However, I'm not sure that I removed ALL ruby packages first, so I will
try that.

--
Eric Hodel - drbrain@segment7.net - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com

WTF? I go to compile my own zlib, so I am trying to remove zlib1g, when
I get:

The following packages will be REMOVED:
  base-config console-common console-data console-tools cramfsprogs
emacs21
  file gnupg initrd-tools initscripts libgnutls10 libldap2 libmagic1
libneon24
  libopencdk8 libpng12-0 libtiff4 libxml2 libzzip-0-10 libzzip-dev
lvm-common
  lvm10 lvm2 lynx modutils openssh-client openssh-server python
python2.3
  reportbug sysvinit udev util-linux w3m zlib1g zlib1g-dev
WARNING: The following essential packages will be removed
This should NOT be done unless you know exactly what you are doing!
  sysvinit initscripts (due to sysvinit) util-linux zlib1g (due to
util-linux)

Obviously I aborted. I am now wondering whether it is even advisable to
make my own build of zlib. Hmm.

···

--
Posted via http://www.ruby-forum.com/.

Eric Hodel wrote:

Did you re-run configure?

Most certainly. Every single time.

···

--
Posted via http://www.ruby-forum.com/\.

Oh well, I'm throwing in the towel for tonight.

Another day, another hour wasted on ruby ;->

This is all incredibly frustrating. Oh well. Thanks for the help,
anonymous dude.

···

--
Posted via http://www.ruby-forum.com/.

Ryan Tate wrote:

Most certainly. Every single time.

Also, I ran 'make clean' each time to cleanup the prior install to make
sure make didn't skip over things later.

···

--
Posted via http://www.ruby-forum.com/\.

YES! Done. Done. Done!

Basically after make and make test and make install still didn't produce
a working gems (same zlib error), I cd-ed into /[ruby source
dir]/ext/zlib and poked around. There was a Makefile, but make didn't
work on it. Noticed extconf.rb. Executed it in ruby. Tried make again.
Bingo. Tried make install. Bingo. Tried installing gems. Booyah!

It seems the main thing that happened is that the ruby zlib make file
put zlib.so in /usr/local/lib/ruby/site_ruby/1.8/i686-linux.

IMHO this means something is likely borked on the ruby 184 source
install. Shouldn't it have done all this for me? Or noted it in the
docs?

Anywhere, here's the sordid transcripts, with some inconsequential cd-s
and cat-s omitted. By the way, I did this on top of my prior source
install, after it had run.

Time to escape to the gym!

root@li9-121 ~ [602] cd ruby-1.8.4
root@li9-121 ~/ruby-1.8.4 [603] cd ext
root@li9-121 ~/ruby-1.8.4/ext [604] cd zlib
root@li9-121 ~/ruby-1.8.4/ext/zlib [606] ls
Makefile doc extconf.rb mkmf.log zlib.c
root@li9-121 ~/ruby-1.8.4/ext/zlib [616] ruby extconf.rb
checking for deflateReset() in -lz... yes
checking for zlib.h... yes
checking for kind of operating system... Unix
creating Makefile
root@li9-121 ~/ruby-1.8.4/ext/zlib [617] make
gcc -fPIC -g -O2 -I. -I/usr/local/lib/ruby/1.8/i686-linux
-I/usr/local/lib/ruby/1.8/i686-linu\
x -I. -DHAVE_ZLIB_H -DOS_CODE=OS_UNIX -c zlib.c
gcc -shared -L'/usr/local/lib' -Wl,-R'/usr/local/lib' -o zlib.so zlib.o
-lz -ldl -lcrypt -l\
m -lc
root@li9-121 ~/ruby-1.8.4/ext/zlib [618] ls
Makefile doc extconf.rb mkmf.log zlib.c zlib.o zlib.so
root@li9-121 ~/ruby-1.8.4/ext/zlib [619] make test
make: *** No rule to make target `test'. Stop.
root@li9-121 ~/ruby-1.8.4/ext/zlib [620] make install
/usr/bin/install -c -m 0755 zlib.so
/usr/local/lib/ruby/site_ruby/1.8/i686-linux
root@li9-121 ~/ruby-1.8.4/ext/zlib [621] cd ../../../rubygems-0.8.11
root@li9-121 ~/rubygems-0.8.11 [622] ruby setup.rb
---> bin
<--- bin
---> lib
---> lib/rubygems
<--- lib/rubygems
<--- lib
---> bin
adjusting shebang: gem_mirror
<--- bin
---> lib
---> lib/rubygems
<--- lib/rubygems
<--- lib
rm -f InstalledFiles
---> bin
mkdir -p /usr/local/bin/
install gemwhich /usr/local/bin/
install gem /usr/local/bin/
install gem_server /usr/local/bin/
install generate_yaml_index.rb /usr/local/bin/
install update_rubygems /usr/local/bin/
install gem_mirror /usr/local/bin/
<--- bin
---> lib
mkdir -p /usr/local/lib/ruby/site_ruby/1.8/
install ubygems.rb /usr/local/lib/ruby/site_ruby/1.8/
install rubygems.rb /usr/local/lib/ruby/site_ruby/1.8/
install gemconfigure.rb /usr/local/lib/ruby/site_ruby/1.8/
---> lib/rubygems
mkdir -p /usr/local/lib/ruby/site_ruby/1.8/rubygems
install specification.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install builder.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install command.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install config_file.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install custom_require.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install doc_manager.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install format.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install cmd_manager.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install gem_runner.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install installer.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install loadpath_manager.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install old_format.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install open-uri.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install package.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install remote_installer.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install rubygems_version.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install source_index.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install deployment.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install timer.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install user_interaction.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install validator.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install version.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install gem_commands.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install dependency_list.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install security.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
install gem_openssl.rb /usr/local/lib/ruby/site_ruby/1.8/rubygems
<--- lib/rubygems
<--- lib

As of RubyGems 0.8.0, library stubs are no longer needed.
Searching $LOAD_PATH for stubs to optionally delete (may take a
while)...
...done.
No library stubs found.

  Successfully built RubyGem
  Name: sources
  Version: 0.0.1
  File: sources-0.0.1.gem
root@li9-121 ~/rubygems-0.8.11 [623] gem install rails
--include-dependencies
Attempting local installation of 'rails'
Local gem file not found: rails*.gem
Attempting remote installation of 'rails'
Updating Gem source index for: http://gems.rubyforge.org
Successfully installed rails-1.0.0
Successfully installed rake-0.7.0
... etc etc etc (dependencies probably)

···

--
Posted via http://www.ruby-forum.com/.

Ryan, you saved my bacon. I was running into EXACTLY the same problem
tonight. Thought I had my rails all up and running and nothing worked.
Went to the RoR site and it helpfully says that 1.8.2 and 1.8.4 of ruby
work, but not 1.8.3. Guess what version my new Ubuntu has...

Then when I went to source, I saw the exact same problem. Thankfully, I
appear to have run into it about 24 hours after you. :slight_smile:

Anyway, thanks mate - that worked beautifully. Now - someone should be
logging a bug for the ruby folks, no?

···

--
Posted via http://www.ruby-forum.com/.

I'm having the same problem, but when I run:

ruby extconf.rb

I get:

# ruby extconf.rb
checking for deflateReset() in -lz... no
checking for deflateReset() in -llibz... no
checking for deflateReset() in -lzlib... no

What a brick wall. =/

- Rabbit

Thanks a lot Ryan Tate
That actually fixed it.
3 evenings trying to fix the Angel-forsaken thing.

A big Mr Hat from South Park to U.
U rule

Ryan Tate wrote:

···

YES! Done. Done. Done!

Basically after make and make test and make install still didn't produce
a working gems (same zlib error), I cd-ed into /[ruby source
dir]/ext/zlib and poked around. There was a Makefile, but make didn't
work on it. Noticed extconf.rb. Executed it in ruby. Tried make again.
Bingo. Tried make install. Bingo. Tried installing gems. Booyah!

It seems the main thing that happened is that the ruby zlib make file
put zlib.so in /usr/local/lib/ruby/site_ruby/1.8/i686-linux.

--
Posted via http://www.ruby-forum.com/\.

Daniel Waite wrote:

I'm having the same problem, but when I run:

ruby extconf.rb

I get:

# ruby extconf.rb
checking for deflateReset() in -lz... no
checking for deflateReset() in -llibz... no
checking for deflateReset() in -lzlib... no

What a brick wall. =/

- Rabbit

~/tmp/browser_dowloads/ruby-1.8.5-p2/ext/zlib$ ruby extconf.rb
checking for deflateReset() in -lz... no
checking for deflateReset() in -llibz... no
checking for deflateReset() in -lzlib... no
checking for deflateReset() in -lzdll... no
*** extconf.rb failed ***

This is painful. Have yet to discover the right incantations.
Help anyone? Many thanks.

- drub

···

--
Posted via http://www.ruby-forum.com/\.

Install zlib (and, if your OS is that weird, its headers too).

···

On Dec 3, 2006, at 21:42 , David Drub wrote:

Daniel Waite wrote:

I'm having the same problem, but when I run:

ruby extconf.rb

I get:

# ruby extconf.rb
checking for deflateReset() in -lz... no
checking for deflateReset() in -llibz... no
checking for deflateReset() in -lzlib... no

What a brick wall. =/

- Rabbit

~/tmp/browser_dowloads/ruby-1.8.5-p2/ext/zlib$ ruby extconf.rb
checking for deflateReset() in -lz... no
checking for deflateReset() in -llibz... no
checking for deflateReset() in -lzlib... no
checking for deflateReset() in -lzdll... no
*** extconf.rb failed ***

This is painful. Have yet to discover the right incantations.
Help anyone? Many thanks.

--
Eric Hodel - drbrain@segment7.net - http://blog.segment7.net

I LIT YOUR GEM ON FIRE!