読者です 読者をやめる 読者になる 読者になる

プログラマでありたい

おっさんになっても、プログラマでありつづけたい

gemでzlib起因のエラー

技術メモ

fedora coreの環境にもRuby on Railsを入れようとしました。先日の、「CentOS 5にRuby On Railsをインストールする」とほぼ同じ作業をして、gemからrailsをインストールしようとすると下記のようなエラーが出ました。

# /usr/bin/gem install rails
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- zlib (LoadError)
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/package.rb:10
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/format.rb:9
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:11
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:3
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:4
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:140:in `load_and_instantiate'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:65:in `[]'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:118:in `find_command'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:104:in `process_args'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:75:in `run'
        from /usr/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:39:in `run'
        from /usr/bin/gem:24


原因としては、zlibではなくてzlib-develが入っていなかったのが原因のようです。ということでyumからインストールして、再度rubyをmakeし直し。念のため、rubygemsも再ビルドしています。

# yum list installed zlib-devel
Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
 * updates-newkey: mirror.cogentco.com
 * fedora: mirror.cogentco.com
 * updates: mirror.cogentco.com
Installed Packages
zlib-devel.i386                          1.2.3-14.fc8           installed