Unable to install or update Ruby bluecloth gem on Windows Ruby 1.9.2
Asked Answered
M

2

3

I'm getting an error message while trying to update my version of bluecloth gem on Windows. Is there a different version that I need to install for Windows or an alternative to bluecloth that I can use? Unfortunately my development environment is strictly Windows due to other software I work with, otherwise I'd use a Linux environment.

Here's a copy paste of what I get:

C:\Users\Developer1>gem update
Updating installed gems
Updating bluecloth
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:/Ruby192/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... yes
creating extconf.h
creating Makefile

make C:/Ruby192/bin/ruby -e "puts 'EXPORTS', '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
In file included from c:\ruby-devkit\mingw\bin../lib/gcc/mingw32/4.5.2/../../..
/../include/windows.h:48:0,
from c:\ruby-devkit\mingw\bin../lib/gcc/mingw32/4.5.2/../../..
/../include/winsock2.h:22,
from c:/Ruby192/include/ruby-1.9.1/ruby/win32.h:33,
from c:/Ruby192/include/ruby-1.9.1/ruby/defines.h:205,
from c:/Ruby192/include/ruby-1.9.1/ruby/ruby.h:74,
from c:/Ruby192/include/ruby-1.9.1/ruby.h:32,
from bluecloth.h:14,
from bluecloth.c:25:
c:\ruby-devkit\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/windef.h:2
29:23: error: duplicate 'unsigned'
c:\ruby-devkit\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/windef.h:2
38:23: error: duplicate 'unsigned'
c:\ruby-devkit\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/windef.h:2
38:23: error: two or more data types in declaration specifiers
c:\ruby-devkit\mingw\bin../lib/gcc/mingw32/4.5.2/../../../../include/windef.h:2
41:24: error: duplicate 'unsigned'
make: * [bluecloth.o] Error 1

Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/bluecloth-2.2.0 for inspection. Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/bluecloth-2.2.0/ext/gem_make.out Nothing to update

Mciver answered 29/12, 2011 at 23:48 Comment(1)
had you previously installed the gem with gem install bluecloth?Messinger
H
3

It seems the order in which headers are included in the C extension included in BlueCloth are blocking the compilation under Windows.

Applying the following patch:

https://gist.github.com/1539611

Compiles and works.

Perhaps you can report the issue to the gem author?

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

Hope that helps.

Haemostat answered 30/12, 2011 at 12:25 Comment(0)
C
3

The header files in 2.2.0 prevents bluecloth from compile on windows. However, you can patch it by yourself. As Luis Lavena mentioned, you need to apply the path.

  1. Run gem install bluecloth -v '2.2.0' if you haven't already

  2. Apply this patch on bluecloth.h file, on my machine it is located in

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

  3. Go to bluecloth 2.2.0 directory, for example

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

  4. Run rake gem (this may require to install some additional gems).

    Then you should see .gem file created in

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

  5. Open this directory and install the patched gem:

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

Camenae answered 24/11, 2012 at 18:9 Comment(2)
Thanks for the info but that just wiped out the gem completely from it's own directory. You didn't say copy it out first.Tree
I applied the patch but I'm getting the same error I went looking to resolve. But unlike this topic my checks don't find some of the requirements. checking for srand()... no checking for srandom()... no checking for random()... no checking for rand()... no checking for bzero() in string.h,strings.h... no checking for strcasecmp()... no checking for stricmp()... no This extension requires either strcasecmp() or stricmp() Should I reinstall the devkit and try again?Tree

© 2022 - 2024 — McMap. All rights reserved.