错误:无法在Windows上构建gem本机扩展 [英] ERROR: Failed to build gem native extension on Windows

查看:177
本文介绍了错误:无法在Windows上构建gem本机扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安装' redcarpet 'gem时出现以下错误。尽管它在我的朋友机器上安装时没有问题。 (我想安装它来运行 yard
Ruby版本:1.9.3



cmd输出:

  D:\Learning\Common_POM_FW\SampleProjects>院子
[错误]:缺少用于Markdown格式的'redcarpet'gem。使用`gem install redcarpet`安装它

D:\Learning\Common_POM_FW\SampleProjects> gem install redcarpet
临时增强PATH以包含DevKit ...
构建原生扩展。这可能需要一段时间...
错误:安装redcarpet时出错:
错误:无法构建gem本机扩展。

C:/Ruby193/bin/ruby.exe -r ./siteconf20141009-6544-978w4t.rb extconf.rb
创建Makefile

make clean
Makefile:165:***目标模式不包含'%'。停止。

make
Makefile:165:***目标模式不包含'%'。停止。

失败,退出代码2

Gem文件将保持安装在C:/Ruby193/lib/ruby/gems/1.9.1/gems/redcarpet-3.1.2 for inspectio
n。
记录到C的结果:/Ruby193/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9.1/redcarpet-3.1.2/gem_ma
ke.out

更新:使用 https://github.com/oneclick/rubyinstaller/wiki/Development-Kit 当我测试安装与json宝石,它也失败了:($ / b>

我通过链接进行故障排除在github 原生gem扩展错误并按照指示解决,但问题仍然存在。



我添加了两条到Env var C:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\bin; 这会删除行临时增强PATH以包含DevKit ... 出现在cmd上

解决方案

最后,经过多次研究,我发现罪魁祸首是RubyGems版本与原生扩展宝石不兼容!



我有ruby gems ver 2.4.1,但看起来像> 2.4.0有这些问题

gem update --system 2.3.0 对我有用:)
$ b

请参考:https://github.com/rubygems/rubygems/issues/977


I'm getting the below error while installing 'redcarpet' gem. It got installed without issue on my friends machine though. (I want to install this to run yard) Ruby version: 1.9.3

cmd output:

D:\Learning\Common_POM_FW\SampleProjects>yard
[error]: Missing 'redcarpet' gem for Markdown formatting. Install it with `gem install redcarpet`

D:\Learning\Common_POM_FW\SampleProjects>gem install redcarpet
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing redcarpet:
        ERROR: Failed to build gem native extension.

    C:/Ruby193/bin/ruby.exe -r ./siteconf20141009-6544-978w4t.rb extconf.rb
creating Makefile

make  clean
Makefile:165: *** target pattern contains no `%'.  Stop.

make
Makefile:165: *** target pattern contains no `%'.  Stop.

make failed, exit code 2

Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/redcarpet-3.1.2 for inspectio
n.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/extensions/x86-mingw32/1.9.1/redcarpet-3.1.2/gem_ma
ke.out

UPDATE: With the devkit installation instructions provided at https://github.com/oneclick/rubyinstaller/wiki/Development-Kit When I test the installation with json gem it fails there too :(

I went through the link for troubleshoot in github Native gem extension Error and followed the instructions to solve, Yet the problem persists..

I added the two paths to Env var C:\\ruby_devkit\\bin;C:\\ruby_devkit\\mingw\\bin; This removes the line Temporarily enhancing PATH to include DevKit... from appearing on cmd

解决方案

Finally after much research I found the culprit was the RubyGems version incompatibility with native extension gems!!!

I had ruby gems ver 2.4.1 but seems like >2.4.0 has these issues

gem update --system 2.3.0 did the trick for me :)

Refer: https://github.com/rubygems/rubygems/issues/977

这篇关于错误:无法在Windows上构建gem本机扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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