安装 gem 时出错,无法构建 gem 本机扩展 -- 无法加载此类文件 -- mkmf [英] Error installing gem failed to build gem native extensions -- cannot load such file -- mkmf

查看:53
本文介绍了安装 gem 时出错,无法构建 gem 本机扩展 -- 无法加载此类文件 -- mkmf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

RoR 很好,但有时让我想用头撞墙(无论如何这可能是我的错).我只是想安装 Thin 网络客户端 gem,当我运行 sudo gem install thin 时,我收到以下错误(它需要安装 eventmachine宝石优先):

RoR is nice, but sometimes makes me want to bang my head against the wall (and it's probably my fault anyway). I'm simply trying to install the Thin web-client gem, and when I run sudo gem install thin, I get the following error (it requires the installation of the eventmachine gem first):

    sudo gem install thin
    Fetching: eventmachine-1.0.1.gem (100%)
    Building native extensions.  This could take a while...
    ERROR:  Error installing thin:
            ERROR: Failed to build gem native extension.

            /usr/bin/ruby1.9.1 extconf.rb
            /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
            from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
            from extconf.rb:2:in `<main>'

我搜索了无法加载此类文件 -- mkmf"错误,但大多数问题似乎都围绕着这样一个事实:它在 1.8-dev 中可用,但在 1.8 中不可用,但因为我运行的是 1.9.3我想我有 mkmf - 我用 locate mkmf 验证了它:

I've searched for the "cannot load such file -- mkmf" error, but most issues seem to be surrounding the fact that it was available in 1.8-dev but not 1.8, but as I'm running 1.9.3 I figured I had mkmf - which I verified with locate mkmf:

    /home/ubuntu/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb

mkmf 所在的目录显然不在/usr/lib/ruby/... 目录下 - 我不确定这是否是我的问题,但这可能足以让你们中的一位专家快速入门关于正在发生的事情以及可能的解决方案.

The directory that mkmf is located in is obviously not under the /usr/lib/ruby/... directory - I'm not sure if this is my problem or not, but it maybe enough to jumpstart one of you experts out there as to what's going on and what the solution could be.

此外,我使用 RVM 安装 ruby​​ 1.9.3 而不仅仅是 gem install...

Also, I've used RVM to install ruby 1.9.3 rather than just a gem install...

提前致谢!

推荐答案

如果你在使用 RVM,你不应该使用 'sudo'.使用 sudo 在 rvm 路径之外调用 libs 等.试试平坦的

if you're using RVM, you shouldn't ever be using 'sudo'. Using sudo calls libs and such out of the rvm path. Try just a flat

gem install thin

看看是否有帮助.

~凯文

这篇关于安装 gem 时出错,无法构建 gem 本机扩展 -- 无法加载此类文件 -- mkmf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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