有人尝试安装红宝石& rubygems来自Ubuntu的源码(最好是Ubuntu 9)? [英] has anyone tried installing ruby & rubygems from source on ubuntu (preferably unbuntu 9)?

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

问题描述

Ruby on Rails网站建议在Linux下从源代码安装Ruby。
在一个干净的Unbuntu 9安装中,我遇到了一些C库问题,从源代码构建ruby。



我在网上找到关于安装ruby在Ubuntu上有参与使用预先打包(基于.deb)的红宝石。很明显,这不是Rails的人推荐的。



当我做了一个干净的ruby源代码构建时,我发现Rubygems无法安装,因为zlib扩展不起作用。



出现两个问题:

<1> zlib扩展名未建立。



解决方案:

确保zlib在ruby源extn目录中的Setup文件中未被注释,并且


$ b 确保安装了这些zlib ubuntu软件包:

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



< 2)修复了上面的问题1(并且对ruby进行了干净的重建)之后,zlib仍然无法工作,因为扩展无法加载。



您可以看到模块无法通过运行并获得输出为false来加载:

  puts要求'zlib'

我观察到这发生在任何数字在extn目录下的其他C扩展中,所以它似乎是这些扩展的一个更普遍的问题,而不仅仅是特定于zlib的东西。



总结:




  • 我的ruby版本找到特定于ruby的C zlib扩展,但无法加载zlib模块。 此行为似乎发生在/ extn中的其他扩展。



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

解决方案

我没有看到你的问题是什么。你说需要'zlib'返回 false 。但这意味着它确实正常工作!如果出现错误,您将得到 LoadError 异常。


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 Unbuntu 9.

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.

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

Two problems occur:

1) The zlib extension isn't built.

Solution:

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

ii) ensure these zlib ubuntu packages are installed:

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

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

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

puts require '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.

To summarise:

  • My build of ruby finds the ruby-specific C zlib extension but it fails to load the zlib module.
  • This behaviour appears to happen to other extensions in /extn.

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

解决方案

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.

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

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