Bluecloth v2.0.10 在 Windows 7 中无法正常工作
对于 Ruby 187,我从 http://rubyinstaller.org/downloads 下载了 devkit 并按照 https://github.com/oneclick/rubyinstaller/wiki/Development- 的说明进行操作套件。 我还确保了 devkit 通过以下方式正确安装 烟雾测试。
然后我尝试安装蓝牙(v2.0.10)。它失败了 以下错误:
C:\test\typo>gem install bluecloth --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing bluecloth:
ERROR: Failed to build gem native extension.
c:/Ruby187/bin/ruby.exe extconf.rb
checking for srand()... yes
checking for random()... no
checking for rand()... yes
checking for bzero() in string.h,strings.h... no
checking for strcasecmp()... yes
checking for strncasecmp()... yes
checking for mkdio.h... yes
checking for ruby/encoding.h... no
creating extconf.h
creating Makefile
make
gcc -I. -I. -Ic:/Ruby187/lib/ruby/1.8/i386-mingw32 -I. -
DRUBY_EXTCONF_H=\"extcon
f.h\" -DVERSION=\"2.0.4\" -g -O2 -DFD_SETSIZE=256 -I. -Wall -c
bluecloth.c
In file included from c:\rubydevkit\mingw\bin\../lib/gcc/
mingw32/4.5.1/../../../../include/windows.h:48:0,
from c:\rubydevkit\mingw\bin\../lib/gcc/
mingw32/4.5.1/../../../../include/winsock2.h:22,
from c:/Ruby187/lib/ruby/1.8/i386-mingw32/win32/
win32.h:27,
from c:/Ruby187/lib/ruby/1.8/i386-mingw32/defines.h:
186,
from c:/Ruby187/lib/ruby/1.8/i386-mingw32/ruby.h:37,
from bluecloth.h:14,
from bluecloth.c:25:
c:\rubydevkit\mingw\bin\../lib/gcc/mingw32/4.5.1/../../../../include/
windef.h:229:23: error: duplicate 'unsigned'
c:\rubydevkit\mingw\bin\../lib/gcc/mingw32/4.5.1/../../../../include/
windef.h:238:23: error: duplicate 'unsigned'
c:\rubydevkit\mingw\bin\../lib/gcc/mingw32/4.5.1/../../../../include/
windef.h:238:23: error: two or more data types in declaration
specifiers
c:\rubydevkit\mingw\bin\../lib/gcc/mingw32/4.5.1/../../../../include/
windef.h:241:24: error: duplicate 'unsigned'
bluecloth.c: In function 'bluecloth_initialize':
bluecloth.c:190:9: warning: unused variable 'utf8text'
make: *** [bluecloth.o] Error 1
Gem files will remain installed in c:/Ruby187/lib/ruby/gems/1.8/gems/
bluecloth-2.0.10 for inspection.
Results logged to c:/Ruby187/lib/ruby/gems/1.8/gems/bluecloth-2.0.10/
ext/gem_make.out
C:\test\typo>
WIth Ruby 187, I had downloaded devkit from http://rubyinstaller.org/downloads
and followed the instruction per https://github.com/oneclick/rubyinstaller/wiki/Development-Kit.
I had also ensured that devkit is installed properly by following
smoke test.
I had then tried installing bluecloth (v2.0.10). It had failed with
following error:
C:\test\typo>gem install bluecloth --platform=ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing bluecloth:
ERROR: Failed to build gem native extension.
c:/Ruby187/bin/ruby.exe extconf.rb
checking for srand()... yes
checking for random()... no
checking for rand()... yes
checking for bzero() in string.h,strings.h... no
checking for strcasecmp()... yes
checking for strncasecmp()... yes
checking for mkdio.h... yes
checking for ruby/encoding.h... no
creating extconf.h
creating Makefile
make
gcc -I. -I. -Ic:/Ruby187/lib/ruby/1.8/i386-mingw32 -I. -
DRUBY_EXTCONF_H=\"extcon
f.h\" -DVERSION=\"2.0.4\" -g -O2 -DFD_SETSIZE=256 -I. -Wall -c
bluecloth.c
In file included from c:\rubydevkit\mingw\bin\../lib/gcc/
mingw32/4.5.1/../../../../include/windows.h:48:0,
from c:\rubydevkit\mingw\bin\../lib/gcc/
mingw32/4.5.1/../../../../include/winsock2.h:22,
from c:/Ruby187/lib/ruby/1.8/i386-mingw32/win32/
win32.h:27,
from c:/Ruby187/lib/ruby/1.8/i386-mingw32/defines.h:
186,
from c:/Ruby187/lib/ruby/1.8/i386-mingw32/ruby.h:37,
from bluecloth.h:14,
from bluecloth.c:25:
c:\rubydevkit\mingw\bin\../lib/gcc/mingw32/4.5.1/../../../../include/
windef.h:229:23: error: duplicate 'unsigned'
c:\rubydevkit\mingw\bin\../lib/gcc/mingw32/4.5.1/../../../../include/
windef.h:238:23: error: duplicate 'unsigned'
c:\rubydevkit\mingw\bin\../lib/gcc/mingw32/4.5.1/../../../../include/
windef.h:238:23: error: two or more data types in declaration
specifiers
c:\rubydevkit\mingw\bin\../lib/gcc/mingw32/4.5.1/../../../../include/
windef.h:241:24: error: duplicate 'unsigned'
bluecloth.c: In function 'bluecloth_initialize':
bluecloth.c:190:9: warning: unused variable 'utf8text'
make: *** [bluecloth.o] Error 1
Gem files will remain installed in c:/Ruby187/lib/ruby/gems/1.8/gems/
bluecloth-2.0.10 for inspection.
Results logged to c:/Ruby187/lib/ruby/gems/1.8/gems/bluecloth-2.0.10/
ext/gem_make.out
C:\test\typo>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您需要 2.2.0(最新版本),我的工作方式如下:
安装 DevKit
运行以下命令安装蓝牙:
gem 安装蓝牙
在构建“本机扩展”时,这会严重失败,但会成功安装 gem 的源代码。
补丁 bluecloth.h 文件(对我来说,该文件位于:D:\ruby\Ruby-1.9.3-p125\lib\ruby\gems\1.9.1\gems\bluecloth -2.2.0\ext),补丁来自这里:https://gist.github.com/1539611
转至bluecloth 的 gem 安装文件夹。对我来说,这看起来如下:
D:\ruby\Ruby-1.9.3-p125\lib\ruby\gems\1.9.1\gems\bluecloth-2.2.0
运行以下命令:
耙宝石
它可能会提示您安装其他一些gem,请按照要求进行操作。
完成后,您应该会看到创建了 bluecloth-2.2.0.gem。对我来说,它可以在这里找到:
D:\ruby\Ruby-1.9.3-p125\lib\ruby\gems\1.9.1\gems\bluecloth-2.2.0\pkg\bluecloth-2.2.0.gem
转到 bluecloth-2.2.0.gem 位置,然后运行以下命令:
gem install bluecloth-2.2.0.gem --platform=ruby
If you need 2.2.0 (the latest version), here's how I got it to work:
Install DevKit
Run the command below to install bluecloth:
gem install bluecloth
this will fail miserably when building "native extensions", but will successfully install the gem's source code.
Patch bluecloth.h file (for me, this is found in: D:\ruby\Ruby-1.9.3-p125\lib\ruby\gems\1.9.1\gems\bluecloth-2.2.0\ext), with the patch from here: https://gist.github.com/1539611
Go to bluecloth's gem installation folder. For me, this looks like below:
D:\ruby\Ruby-1.9.3-p125\lib\ruby\gems\1.9.1\gems\bluecloth-2.2.0
Run the following command:
rake gem
It may prompt you to install some other gems, follow accordingly.
When it's done, you should see a bluecloth-2.2.0.gem created. For me, it is found here:
D:\ruby\Ruby-1.9.3-p125\lib\ruby\gems\1.9.1\gems\bluecloth-2.2.0\pkg\bluecloth-2.2.0.gem
Go to bluecloth-2.2.0.gem location, and run the following command:
gem install bluecloth-2.2.0.gem --platform=ruby
BlueCloth 2.0.10 版本似乎存在错误/问题。您可以尝试使用旧版本,例如 2.0.7:
这似乎有效。
也许这值得检查最新版本(2.2.0?),如果不起作用,请将其报告给 gem 作者:
http://deveiate.org/projects/BlueCloth/query
It seems there is a bug/issue with version 2.0.10 of BlueCloth. You can try using an older version like 2.0.7:
Which seems to work.
Also probably this worth checking latest version (2.2.0?) and if not work, report it back to gem author:
http://deveiate.org/projects/BlueCloth/query
这是修补后的 bluecloth.h 代码,对于赶时间的人来说......
This is the patched bluecloth.h code, for people in a hurry...
github 上有一个分支已经包含该补丁:
https://github.com/drakontia/bluecloth
There's a fork on github that already includes the patch:
https://github.com/drakontia/bluecloth