松窗竹户

2007年05月21日

关于安装rubygems-0.9.3的zlib错误解决

类归于: ruby or rails — 标签:, — bugx @ 16:04

初次接触Linux下RUBY环境安装,加上对linux的不熟悉,走了不少弯路。
特别是关于ruby1.8.65装好后装gems出现这个错误。
usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’: no such file to load — zlib (LoadError)
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/package.rb:9
终于在不懈的探索下,昨天晚上搞定了。

网上出现这个问题的人蛮多的,可能大家的编译环境不同,我尝试了他们的方法,折腾了2个晚上,终于发现解决之道。记下一笔,做为学习RUBY的一点经验积累。
我的系统环境是Red Hat AS4,最小化安装,所以会没有装上一些包,可能就出了这个问题。少了一个ruby-zlib,但当我根据网上的解决方法
ruby extconf.rb
checking for deflateReset() in -lz… no
checking for deflateReset() in -llibz… no
checking for deflateReset() in -lzlib… no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
又出现了这个错误。明显少了zlib,用了Ubuntu的方法,又出现
apt-get install zlib1g-dev
Reading Package Lists… Done
Building Dependency Tree… Done
E: Couldn’t find package zlib1g-dev
下了ruby-zlib也装不上
后来尝试用了apt-get install zlib-devel ,就可以了。
ruby extconf.rb
checking for deflateReset() in -lz… yes
checking for zlib.h… yes
checking for kind of operating system… Unix
creating Makefile
make
make install
再装rubygems的时候就非常顺利
Successfully built RubyGem
Name: sources
Version: 0.0.1
file: sources-0.0.1.gem
Removing old RubyGems RDoc and ri…
Installing rubygems-0.9.3 ri…
Installing rubygems-0.9.3 rdoc…

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.

新手上路,呵呵。

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google

评论暂缺

还没有任何评论。

这篇文章上的评论 RSS feed

抱歉,评论暂时关闭。

WordPress 所驱动