# Building ruby on rails

**URL:** <https://www.ruby-forum.com/t/building-ruby-on-rails/183449>\
**Category:** Ruby\
**Created:** [February 14, 2010, 5:23pm UTC](https://www.ruby-forum.com/t/building-ruby-on-rails/183449 "2010-02-14T17:23:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Felt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@Michael\_Felt](https://www.ruby-forum.com/u/Michael_Felt)\
**Post date:** [February 14, 2010, 5:23pm UTC](https://www.ruby-forum.com/t/building-ruby-on-rails/183449/1 "2010-02-14T17:23:25Z")

</div>

Hello,

I have downloaded ruby-1.91-1-p376, configured and built

(./configure --with-pthreads; make;make install)

downloaded rubygem 1.3.5, unpacked, then

ruby setup.rb

And when I run

# gem install rails

I get the following error:

# gem install rails

/usr/local/lib/ruby/site\_ruby/1.9.1/rubygems/package.rb:10:in `require': no such file to load -- zlib (LoadError) from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/package.rb:10:in`\<top (required)\>’  
from /usr/local/lib/ruby/site\_ruby/1.9.1/rubygems/format.rb:9:in  
`require' from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/format.rb:9:in`\<top (required)\>’  
from  
/usr/local/lib/ruby/site\_ruby/1.9.1/rubygems/installer.rb:11:in  
`require' from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:11:in`\<top (required)\>’  
from  
/usr/local/lib/ruby/site\_ruby/1.9.1/rubygems/dependency\_installer.rb:3:in  
`require' from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:3:in`\<top (required)\>’  
from  
/usr/local/lib/ruby/site\_ruby/1.9.1/rubygems/commands/install\_command.rb:4:in  
`require' from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/commands/install_command.rb:4:in`\<top (required)\>’  
from  
/usr/local/lib/ruby/site\_ruby/1.9.1/rubygems/command\_manager.rb:167:in  
`require' from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:167:in`rescue in load\_and\_instantiate’  
from  
/usr/local/lib/ruby/site\_ruby/1.9.1/rubygems/command\_manager.rb:159:in  
`load_and_instantiate' from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:88:in`[]’  
from  
/usr/local/lib/ruby/site\_ruby/1.9.1/rubygems/command\_manager.rb:144:in  
`find_command' from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:131:in`process\_args’  
from  
/usr/local/lib/ruby/site\_ruby/1.9.1/rubygems/command\_manager.rb:102:in  
`run' from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:58:in`run’  
from /usr/local/bin/gem:21:in `’

# 

when I check nohup.out from the make and grep for zlib I see the  
following:

# grep zlib noh\*

nohup.make:compiling zlib

And checking the nohup.out from the install I get the following for the  
required packages in ‘package.rb’ (e.g., stringio and yaml)

nohup.out:ext/zlib/zlib.c:  
MCCCCCCCCCCCCCCCCCCmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

# grep zlib .installed\*

/usr/local/share/ri/1.9.1/system/Zlib/zlib\_version-c.yaml

# grep stringio .installed\*

/usr/local/lib/ruby/1.9.1/yaml/stringio.rb  
/usr/local/lib/ruby/1.9.1/powerpc-aix5.3.0.0/stringio.so

# grep fileutils .installed\*

/usr/local/lib/ruby/1.9.1/fileutils.rb

It looks like zlib has been compiled, but not installed?

These are the zlib files in the package area:

# pwd

/data/prj/ruby-1.9.1-p376

# find . | grep zlib

./ext/zlib  
./ext/zlib/.cvsignore  
./ext/zlib/doc  
./ext/zlib/doc/zlib.rd  
./ext/zlib/extconf.rb  
./ext/zlib/zlib.c  
./ext/zlib/mkmf.log  
./ext/zlib/Makefile  
./.ext/rdoc/Zlib/zlib\_version-c.yaml  
./test/zlib  
./test/zlib/test\_zlib.rb

These are the ‘zlib’ files in the installed area:

# cd /usr/local

# find . | grep zlib

./share/ri/1.9.1/system/Zlib/zlib\_version-c.yaml

Suggestions welcome.

---

<div class="post-metadata">

**Author:** ![Michael\_Felt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@Michael\_Felt](https://www.ruby-forum.com/u/Michael_Felt)\
**Post date:** [February 14, 2010, 11:27pm UTC](https://www.ruby-forum.com/t/building-ruby-on-rails/183449/2 "2010-02-14T23:27:28Z")

</div>

I have come a bit further, but not found a solution.

via IRC i was pointed at this “rejected” bug-report:  
[http://redmine.ruby-lang.org/issues/show/1157](http://redmine.ruby-lang.org/issues/show/1157)

However, regardless of whether I re-run configure with  
CFLAGS=/usr/local/include (where zlib.h is located), or not during make  
the  
flag -I/usr/include/local is not added to the test, so make “fails” in  
that  
zlib.rb and/or Makefile in ./ext/zlib does not get made.

for ./ext/zlib/mkmf.log

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

“cc -qlanglvl=extc89 -E -I…/…/.ext/include/powerpc-aix5.3.0.0  
-I…/…/./include -I…/…/./ext/zlib -D\_LARGE\_FILES=1  
-I/usr/lib/include  
-g conftest.c \> conftest.i”  
“conftest.c”, line 3.10: 1506-296 (S) #include file \<zlib.h\> not found.  
checked program was:  
/\* begin _/  
1: #include “ruby.h”  
2:  
3: #include \<zlib.h\>  
/_ end \*/

If I am missing something - not obvious to me - please suggest!

---

<div class="post-metadata">

**Author:** ![Michael\_Felt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@Michael\_Felt](https://www.ruby-forum.com/u/Michael_Felt)\
**Post date:** [February 15, 2010, 10:49am UTC](https://www.ruby-forum.com/t/building-ruby-on-rails/183449/3 "2010-02-15T10:49:47Z")

</div>

Michael Felt wrote:

> I have downloaded ruby-1.91-1-p376, configured and built
> 
> (./configure --with-pthreads; make;make install)
> 
> downloaded rubygem 1.3.5, unpacked, then
> 
> ruby setup.rb
> 
> And when I run
> 
> # gem install rails
> 
> I get the following error:
> 
> # gem install rails
> 
> /usr/local/lib/ruby/site\_ruby/1.9.1/rubygems/package.rb:10:in `require’:  
> no  
> such file to load – zlib (LoadError)

This means that ruby zlib library wasn’t built when you were building  
ruby 1.9, but rubygems needs it.

The solution depends on what system you are building under. For example,  
if you are building under Ubuntu, then you need to do

```
sudo apt-get install zlib1g-dev

```

then reconfigure and rebuild ruby 1.9 from scratch, so it can detect the  
zlib header files and build the ruby zlib extension, then try and build  
rubygems again.

I’d also recommend

```
sudo apt-get install libssl-dev

```

before building ruby, because without this, ruby won’t have openssl  
support and hence can’t do HTTPS.

Regards,

Brian.

---

<div class="post-metadata">

**Author:** ![Michael\_Felt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@Michael\_Felt](https://www.ruby-forum.com/u/Michael_Felt)\
**Post date:** [February 16, 2010, 4:53pm UTC](https://www.ruby-forum.com/t/building-ruby-on-rails/183449/4 "2010-02-16T16:53:12Z")

</div>

My “solution” was a lot simplier. As all the files were there but  
miniruby/ruby installer was not finding them I just copied zlib.h and  
zconf.h (inserted by zlib.h) into /include (the  
…/…/include  
reference) and the build and gem install worked fine after that.

Thanks for the advice!
