有没有人尝试安装ruby&来自Ubuntu(最好是Ubuntu 9)上的rubygems吗? [英] has anyone tried installing ruby & rubygems from source on Ubuntu (preferably Ubuntu 9)?

查看:66
本文介绍了有没有人尝试安装ruby&来自Ubuntu(最好是Ubuntu 9)上的rubygems吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Ruby on Rails网站建议在Linux下从源代码安装Ruby. 我在干净安装Ubuntu 9时从源代码构建ruby时遇到了许多C库问题.

The Ruby on Rails website recommends installing Ruby from source under Linux. I encountered a number of C library problems building ruby from source on a clean install of Ubuntu 9.

我在网上找到的有关在Ubuntu上安装ruby的所有说明都涉及到使用预打包的(基于.deb的)ruby.显然,这不是人们所建议的.

All the instructions I found on the net about installing ruby on Ubuntu have involved using the prepackaged (.deb-based) ruby. Clearly this isn't what the rails people recommend.

当我进行红宝石的干净构建时,我发现Rubygems无法安装,因为zlib扩展无法正常工作.

When I did a clean source build of ruby I found Rubygems failed to install because the zlib extension didn't work.

发生两个问题:

1)未构建zlib扩展.

1) The zlib extension isn't built.

解决方案:

i)确保zlib在ruby源的extn目录中的安装文件中未注释,并且

i) ensure zlib is uncommented in the Setup file within the extn directory of the ruby source, and

ii)确保已安装以下zlib ubuntu软件包:

ii) ensure these zlib ubuntu packages are installed:

aptitude install zlib1g
aptitude install zlib1g-dbg
aptitude install zlib1g-dev
aptitude install zlibc

2)在修复了上面的问题1(并进行了Ruby的干净重建)之后,zlib仍然无法正常工作,因为扩展无法加载.

2) After fixing Problem 1 above (and doing a clean rebuild of ruby), zlib still doesn't work because the extension fails to load.

通过运行此命令并获取输出"false",可以看到模块加载失败:

You can see that the module fails to load by running this and getting the output "false":

puts require 'zlib'

我观察到extn目录中任意数量的其他C扩展都发生了这种情况,因此这些扩展似乎是比zlib特定问题更普遍的问题.

I observed this happens to any number of other C extensions in the extn directory, so it appears to be a more general problem with these extensions than just something zlib-specific.

总结:

  • 我的ruby构建找到了特定于ruby的C zlib扩展,但是无法加载zlib模块.
  • 此行为似乎发生在/extn中的其他扩展名上.

有没有一种方法可以找出模块加载失败的原因?某种跟踪/详细模式?

Is there a way I can find out why a module fails to load? some kind of trace/verbose mode?

推荐答案

我看不到您的问题是什么.您说require 'zlib'返回false.但这意味着它没有起作用!如果出现错误,您将得到LoadError异常.

I don't see what your problem is. You say that require 'zlib' returns false. But that means that it did work! If there were an error, you would get a LoadError exception.

这篇关于有没有人尝试安装ruby&来自Ubuntu(最好是Ubuntu 9)上的rubygems吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆