简体   繁体   English

zlib上的Ubuntu rails安装失败

[英]Ubuntu rails install fails on zlib

I've just moved over to Ubuntu 8.10 as my dev box; 我刚刚转到Ubuntu 8.10作为我的开发盒; it's my first serious foray into Linux as a daily-use OS, and I'm having a hard time getting Rails going. 这是我第一次认真进军Linux作为日常使用的操作系统,而且我很难让Rails继续运行。 I have followed a number of tutorials which all seem to work fine, but when I try and use gem install or gem update on anything, I get an error that looks like this: 我已经遵循了一些似乎工作正常的教程,但是当我尝试使用gem install或gem update时,我得到一个如下错误:

/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- zlib (LoadError)
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:1
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/commands/update_command.rb:5
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:167:in `load_and_instantiate'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:88:in `[]'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:144:in `find_command'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:131:in `process_args'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:102:in `run'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:58:in `run'
from /usr/local/bin/gem:21

I have (as recommended in the tutorials) installed zlib, zlib1g, and zlib1g-dev. 我(在教程中推荐)安装了zlib,zlib1g和zlib1g-dev。 I've even found a few tutorials on this particular problem (all for flavors other than mine, however) but they didn't help. 我甚至找到了一些关于这个特殊问题的教程(但是除了我的以外的所有口味),但它们没有帮助。

I'm on Ubuntu 8.10, ruby version 1.8.8dev gem version 1.3.2 我在Ubuntu 8.10,ruby版本1.8.8dev gem version 1.3.2

I've tried reinstalling ruby and gems each and separately, to no avail. 我尝试过各自单独重新安装红宝石和宝石,但无济于事。

If you come across this question trying to install Ruby using Ruby Version Manager (RVM) on Ubuntu 10.04 then there are instructions on installing zlib on the rvm web site http://rvm.beginrescueend.com/packages/zlib/ 如果您在Ubuntu 10.04上尝试使用Ruby Version Manager(RVM)安装Ruby时遇到此问题,那么有关于在rvm网站上安装zlib的说明http://rvm.beginrescueend.com/packages/zlib/

The steps are: 步骤是:

rvm pkg install zlib

(or rvm package install zlib if you get "ERROR: Unrecognized command line argument: 'pkg'" - older versions of rvm used the verb 'package' instead) (或rvm package install zlib如果你得到“错误:无法识别的命令行参数:'pkg'” - 旧版本的rvm使用动词'包'代替)

then 然后

rvm remove 1.9.1
rvm install 1.9.1

I am using Ubuntu 10.04 (Lucid), i wanted to install ruby 1.9.2 because 1.9.1 is not recommended with Rails. 我使用的是Ubuntu 10.04(Lucid),我想安装ruby 1.9.2因为不推荐使用Rails的1.9.1。 So I downloaded the source for 1.9.2 and unzipped/unarchived it. 所以我下载了1.9.2的源代码并解压缩/取消归档它。 my source distro is ruby-1.9.2-p0. 我的源发行版是ruby-1.9.2-p0。 After I unpacked it, I built zlib as follows: 解压缩后,我按如下方式构建了zlib:

cd ruby-1.9.2-p0/ext/zlib
ruby extconf.rb
make
sudo make install
sudo gem install rails

that fixed the problem. 解决了这个问题。 This is similar to what other people posted above, but not exactly, so I figured I may as well post exactly what I did to get it going. 这与上面发布的其他人类似,但并不完全如此,所以我想我也可以发布我所做的事情来实现它。

I have the same problem in CentOS and fix it by executing the following command: 我在CentOS中遇到同样的问题并通过执行以下命令来修复它:

First, I ensure that zlib and zlib-devel exist (like many suggested above). 首先,我确保存在zlib和zlib-devel(如上所述)。

yum install zlib zlib-devel

Second, I recompiled and installed the sources of zlib that comes with ruby. 其次,我重新编译并安装了ruby附带的zlib源代码。

cd /home/myname/installers/ruby-1.8.7-p174/ext/zlib/
ruby extconf.rb --with-zlib-include=/usr/include --with-zlib-lib=/usr/lib
make
make install

That commands seem to fix the problem, then I execute gem update --system and the error with zlib vanished. 这些命令似乎解决了问题,然后我执行gem update --system并且zlib的错误消失了。 Then I install rails with gem install rails. 然后我用gem install rails安装rails。 Note to mention I had installed gem before, and after recompile and install zlib, I don't recompile neither install gem (actually I don't knew how uninstall it because I don't found a script to do that) 请注意,我之前已经安装了gem,并且在重新编译和安装zlib之后,我不重新编译安装gem(实际上我不知道如何卸载它因为我没有找到一个脚本来执行此操作)

That works for me...hope to you to. 这对我有用...希望你。

Regards. 问候。

try 尝试

aptitude install zlib1g-dev

Then go about your business. 然后开始你的事业。

I really didn't like any of these answers ... none really focused on the users actual needs and question ... just people telling what they did ... no context and it didn't even work for me ... 我真的不喜欢这些答案中的任何一个...没有真正关注用户的实际需求和问题......只是人们告诉他们做了什么......没有上下文,它甚至对我不起作用......

So, .. 那么,..

I'm installing a new box Ubuntu 8.04 LTS 64-bit ... 我正在安装一个新的盒子Ubuntu 8.04 LTS 64位...

So, I ... 所以我 ...

cd ~  
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz  
tar -xvvf ruby-1.9.2-p180.tar.gz  
cd ruby-*  
./configure  
make  
install  
sudo make install  

And then I have this problem with ... 然后我有这个问题......

gem list

it doesn't work ... something about zLib not found crap ... 它不起作用......关于zLib找不到垃圾...

So, I actually READ the README and find that I need to edit a file ... 所以,我实际上阅读了README并发现我需要编辑一个文件......

[my ruby source directory]/ext/Setup

and UN-COMMENT the line with zLib in it ... by removing the "#" in the first column 和UN-COMMENT中包含zLib的行...删除第一列中的“#”

Then I run the commands again ... included here for reference ... 然后我再次运行命令...包含在这里供参考......

./configure
make  
install  
sudo make install  

and all is well ... it's logical ... and is devoid of "rvm" and other ... "just install more stuff to make it work" type solutions. 一切都很好......这是合乎逻辑的...而且没有“rvm”和其他......“只需要安装更多的东西来使其工作”类型的解决方案。

Joet Joet

Just goto Ruby Source Package , Unzip it. 只需转到Ruby Source Package,解压缩它。

Goto /your-ruby-dir/ext/zlib 转到/你的ruby-dir / ext / zlib

ruby extconf.rb
make
sudo make install

If the packages are missing it will tell you, mainly libzlib related packages 如果缺少包,它会告诉你,主要是与libzlib相关的包

Regards 问候

Saurabh SAURABH

rvm package install zlib
rvm remove 1.9.1
rvm install 1.9.1

That did it. 这样做了。 After numerous wild goose chases, I'm glad I found this page. 经过无数次的疯狂追逐,我很高兴找到了这个页面。

yes, and that didn't do the job either. 是的,那也没有完成这项工作。 Got this from another source, this finally did it for me where the other stuff failed. 从另一个来源获得这个,这最终为我做了其他东西失败的地方。

wget http://www.blue.sky.or.jp/atelier/ruby/ruby-zlib-0.6.0.tar.gz
tar xvzf ruby-zlib-0.6.0.tar.gz
cd ruby-zlib-0.6.0
ruby extconf.rb && make
sudo make install

Reinstall ruby gems from source 从源代码重新安装ruby gems

Thanks anyway, guys. 不管怎样,谢谢你们。

On Debian (Squeeze): 在Debian(Squeeze):

libruby contains zlib for ruby amongst all the other stuff you'll need to make ruby work properly on Debian. libruby包含zlib,用于ruby中所有其他东西,你需要让ruby在Debian上正常工作。 So... 所以...

apt-get install libruby

Then... 然后...

cd /usr/local/src/ruby
make clean
make
make install
cd ../rubygems
ruby setup.rb
gem install rails

This made it work for me, but your mileage may vary. 这使它对我有用,但你的里程可能会有所不同。 I did to a slight shotgun approach to zlib before finding that everything needed was covered by libruby. 在发现所需的一切都被libruby覆盖之前,我对zlib采取了轻微的霰弹枪方法。

The problem is that Ruby on Ubuntu isn't built against zlib; 问题是Ruby on Ubuntu不是针对zlib构建的; you'll want to do a source build to install Ruby. 你想要做一个源代码构建来安装Ruby。 You can do this with apt-get source -b ruby 你可以使用apt-get source -b ruby来做到这一点

Did you try apt-get install libzlib-ruby? 你尝试过apt-get install libzlib-ruby吗?

Also install rubygems from rubyforge. 还要从rubyforge安装rubygems。 I don't like the rubygems package in Ubuntu. 我不喜欢Ubuntu中的rubygems包。

You could try to download the ruby enterprise deb package on the phusion site. 您可以尝试在phusion站点下载ruby enterprise deb软件包。 And install passenger through the package. 并通过包装安装乘客。 Follow the instructions here . 按照此处的说明操作。 Or you could try the bash script found here . 或者您可以尝试这里找到的bash脚本。

When running Rails I would not recommend using Ruby 1.8.8dev. 运行Rails时我不建议使用Ruby 1.8.8dev。 Stick with 1.8.6, preferably the Ruby Enterprise Edition. 坚持1.8.6,最好是Ruby Enterprise Edition。 See this post on RailsLab what other people are using. RailsLab上看到这篇文章,其他人正在使用它。

If you insist on going hi-tech, install Ruby 1.9.1. 如果你坚持高科技,请安装Ruby 1.9.1。

But in both cases build it yourself or use Marans suggestion. 但在这两种情况下都要自己构建或使用Marans建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM