无法在Windows Ruby 1.9.2上安装或更新Ruby bluecloth gem

我试图在Windows上更新我的bluecloth gem版本时收到错误消息。 是否有我需要为Windows安装的不同版本或我可以使用的蓝布替代品? 不幸的是,由于我使用的其他软件,我的开发环境严格来说是Windows,否则我会使用Linux环境。

这是我得到的复制粘贴:

C:\ Users \ Developer1> gem update
更新已安装的gem
更新蓝布
暂时增强PATH以包括DevKit ……
构建原生扩展。 这可能需要一段时间……
错误:安装蓝布时出错:
错误:无法构建gem原生扩展。

C:/Ruby192/bin/ruby.exe extconf.rb
检查srand()……是的
检查随机()…没有
检查兰德()…是的
检查string.h中的bzero(),strings.h … no
检查strcasecmp()…是的
检查strncasecmp()…是的
检查mkdio.h …是的
检查ruby / encoding.h …是的
创建extconf.h
创建Makefile

make C:/ Ruby192 / bin / ruby​​ -e“puts’DORTSORTS’,’Init_bluecloth_ext’”> bluecloth_ext-i386-mingw32.def gcc -I。 -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -I / C / Ruby192 / include / ruby​​-1
.9.1 / ruby​​ / backward -I / C / Ruby192 / include / ruby​​-1.9.1 -I。 -DRUBY_EXTCONF_H = \“extconf.h \” – DVERSION = \“2.0.9 \” – O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field -initializers -Wno-long-long -I。 -o bluecloth.o -c bluecloth.c
在c:\ ruby​​-devkit \ mingw \ bin ../ lib / gcc / mingw32 / 4.5.2 /../../中包含的文件中。
/../include/windows.h:48:0,
来自c:\ ruby​​-devkit \ mingw \ bin ../ lib / gcc / mingw32 / 4.5.2 /../../ ..
/../include/winsock2.h:22,
来自c:/Ruby192/include/ruby-1.9.1/ruby/win32.h:33,
来自c:/Ruby192/include/ruby-1.9.1/ruby/defines.h:205,
来自c:/Ruby192/include/ruby-1.9.1/ruby/ruby.h:74,
来自c:/Ruby192/include/ruby-1.9.1/ruby.h:32,
来自bluecloth.h:14,
来自bluecloth.c:25:
C:\ruby的devkit \的mingw \ BIN ../ LIB / GCC /的mingw32 / 4.5.2 /../../../../包括/ WINDEF.H:2
29:23:错误:重复’unsigned’
C:\ruby的devkit \的mingw \ BIN ../ LIB / GCC /的mingw32 / 4.5.2 /../../../../包括/ WINDEF.H:2
38:23:错误:重复’unsigned’
C:\ruby的devkit \的mingw \ BIN ../ LIB / GCC /的mingw32 / 4.5.2 /../../../../包括/ WINDEF.H:2
38:23:错误:声明说明符中有两个或更多数据类型
C:\ruby的devkit \的mingw \ BIN ../ LIB / GCC /的mingw32 / 4.5.2 /../../../../包括/ WINDEF.H:2
41:24:错误:重复’unsigned’
make: * [bluecloth.o]错误1

Gem文件将保留在C:/Ruby192/lib/ruby/gems/1.9.1/gems/bluecloth-2.2.0中进行检查。 结果记录到C:/Ruby192/lib/ruby/gems/1.9.1/gems/bluecloth-2.2.0/ext/gem_make.out无需更新

似乎BlueCloth中包含的C扩展中包含头的顺序阻止了Windows下的编译。

应用以下补丁:

https://gist.github.com/1539611

编译和工作。

也许你可以向gem作者报告这个问题?

http://deveiate.org/projects/BlueCloth https://github.com/ged/bluecloth

希望有所帮助。

2.2.0中的头文件阻止了bluecloth在windows上编译。 但是,您可以自己修补它。 正如Luis Lavena所提到的,你需要应用这条路径。

  1. 如果你还没有,请运行gem install bluecloth -v '2.2.0'

  2. 将此补丁应用于bluecloth.h文件,位于我所在的计算机上

    H:\Ruby193\lib\ruby\gems\1.9.1\gems\bluecloth-2.2.0\ext\bluecloth.h

  3. 例如,转到bluecloth 2.2.0目录

    H:\Ruby193\lib\ruby\gems\1.9.1\gems\bluecloth-2.2.0

  4. 运行rake gem (这可能需要安装一些额外的gem)。

    然后你应该看到创建的.gem文件

    H:\Ruby193\lib\ruby\gems\1.9.1\gems\bluecloth-2.2.0\pkg\bluecloth-2.2.0.gem

  5. 打开此目录并安装修补的gem:

    gem install bluecloth-2.2.0.gem --platform=ruby