# Rubygems won't install - don't understand why

**URL:** <https://www.ruby-forum.com/t/rubygems-wont-install-dont-understand-why/149012>\
**Category:** Ruby\
**Created:** [September 19, 2008, 10:48am UTC](https://www.ruby-forum.com/t/rubygems-wont-install-dont-understand-why/149012 "2008-09-19T10:48:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbcox23](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tbcox23](https://www.ruby-forum.com/u/tbcox23)\
**Post date:** [September 19, 2008, 10:48am UTC](https://www.ruby-forum.com/t/rubygems-wont-install-dont-understand-why/149012/1 "2008-09-19T10:48:21Z")

</div>

I can’t get rubygems to install, and I don’t understand what the problem  
is or what to do about it.

I’m running on Kubuntu Linux 8.04.1

I compiled ruby-1.8.6-p114 a couple of days ago. Note:

tomc@tom-desktop:/$ which ruby  
/usr/local/bin/ruby  
tomc@tom-desktop:/$ ruby -v  
ruby 1.8.6 (2008-03-03 patchlevel 114) [i686-linux]  
tomc@tom-desktop:/$

I downloaded rubygems-1.2.0.tgz, unpacked it into /usr/local/src/.

Then…

tomc@tom-desktop:/usr/local/src/rubygems-1.2.0$ ruby setup.rb  
./lib/rubygems/spec\_fetcher.rb:1:in `require': no such file to load -- zlib (LoadError) from ./lib/rubygems/spec_fetcher.rb:1 from ./lib/rubygems/source_index.rb:10:in `require’  
from ./lib/rubygems/source\_index.rb:10  
from ./lib/rubygems.rb:767:in `require' from ./lib/rubygems.rb:767 from setup.rb:22:in `require’  
from setup.rb:22

A couple of listings which may help

my ruby compile listing: [http://pastie.org/275615](http://pastie.org/275615)

output of “$ locate zlib” =\> [http://pastie.org/275612](http://pastie.org/275612)

I’m barely able to do this stuff, and certainly don’t understand what  
the complaint is about. I’ve had one kind, knowing soul look at this and  
he didn’t find the problem. To someone here, I’m sure it’ll be obvious.  
I sure hope he/she reads this!

Thanks,

Tom

–

```auto
Tom C., MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< removed_email_address@domain.invalid >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)

```

---

<div class="post-metadata">

**Author:** ![tbcox23](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tbcox23](https://www.ruby-forum.com/u/tbcox23)\
**Post date:** [September 19, 2008, 11:16am UTC](https://www.ruby-forum.com/t/rubygems-wont-install-dont-understand-why/149012/2 "2008-09-19T11:16:37Z")

</div>

> tomc@tom-desktop:/usr/local/src/rubygems-1.2.0$ ruby setup.rb  
> ./lib/rubygems/spec\_fetcher.rb:1:in `require’: no such file to load –  
> zlib (LoadError)

I run Ubuntu 8.04.1 with my own compiled ruby 1.8.6p114, which is very  
close to your setup. The extension exists in  
/usr/local/lib/ruby/1.8/i686-linux/zlib.so

Possibly, the package zlib1g-dev wasn’t present on your system at the  
time when you compiled ruby, and therefore the Ruby zlib extension  
wasn’t built.

If your build directory is still around (i.e. where you untarred the  
source), look in ext/zlib/mkmf.log and see if it points to the problem.  
Here’s mine:

have\_library: checking for deflateReset() in -lz… --------------------  
yes

“gcc -o conftest -I…/… -I…/…/. -I…/…/./ext/zlib -g -O2 conftest.c  
-L’.’ -L’…/…’ -L. -rdynamic -Wl,-export-dynamic -lruby-static -lz  
-ldl -lcrypt -lm -lc”  
conftest.c: In function â€˜tâ€™:  
conftest.c:3: error: â€˜deflateResetâ€™ undeclared (first use in this  
function)  
conftest.c:3: error: (Each undeclared identifier is reported only once  
conftest.c:3: error: for each function it appears in.)  
checked program was:  
/\* begin _/  
1: /top/  
2: int main() { return 0; }  
3: int t() { void ((volatile p)()); p = (void (()()))deflateReset;  
return 0; }  
/_ end \*/

“gcc -o conftest -I…/… -I…/…/. -I…/…/./ext/zlib -g -O2 conftest.c  
-L’.’ -L’…/…’ -L. -rdynamic -Wl,-export-dynamic -lruby-static -lz  
-ldl -lcrypt -lm -lc”  
checked program was:  
/\* begin _/  
1: /top/  
2: int main() { return 0; }  
3: int t() { deflateReset(); return 0; }  
/_ end \*/

* * *

have\_header: checking for zlib.h… -------------------- yes

“gcc -E -I…/… -I…/…/. -I…/…/./ext/zlib -g -O2 conftest.c -o  
conftest.i”  
checked program was:  
/\* begin _/  
1: #include \<zlib.h\>  
/_ end \*/

* * *

In any case, the thing to do now is recompile ruby, and carefully look  
at the ./configure output to see if it says why zlib isn’t being built.  
It may also be helpful to install libssl-dev first, if you haven’t  
already.

HTH,

Brian.
