Bluecloth v2.0.10 with windows 7 not working
Asked Answered
D

4

7

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>
Diarthrosis answered 8/2, 2011 at 11:1 Comment(4)
Seems the issue is a bug of 2.0.10 version. Try using an older version like 2.0.7 (gem install bluecloth -v 2.0.7)Welton
@LuisLavena Thanks! I could install with 2.0.7.Soliz
@LuisLavena given the length of time I wonder if it makes sense for you to move your comment to an answer?Powers
@Powers done! https://mcmap.net/q/1410597/-bluecloth-v2-0-10-with-windows-7-not-working Thanks!Welton
C
13

If you need 2.2.0 (the latest version), here's how I got it to work:

  1. Install DevKit

  2. 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.

  3. 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

  4. 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

  5. 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

  6. Go to bluecloth-2.2.0.gem location, and run the following command:

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

Chambray answered 14/6, 2012 at 16:58 Comment(3)
I had to move the bluecloth-2.2.0.gem into another directory before doing step 6. Otherwise, gem removed the gem installation folder—including the .gem file created in step 5—before proceeding.Catkin
Doing this on bluecloth-2.2.0.gem gets me a bunch of compilation errors: puu.sh/8TPhG.png any idea on how to resolve this?Nunnally
Nevermind, these errors happened because I forgot to include #include "ruby.h" above the #ifdef... just a case of mis-applying a patch.Nunnally
W
6

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:

gem install bluecloth -v 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

Welton answered 1/3, 2012 at 13:3 Comment(0)
C
0

This is the patched bluecloth.h code, for people in a hurry...

#ifndef BLUECLOTH_H
#define BLUECLOTH_H
 
#include "ruby.h"

#if defined(HAVE_RUBY_ENCODING_H) && HAVE_RUBY_ENCODING_H
#	define M17N_SUPPORTED
#	include "ruby/encoding.h"
#endif

#include "config.h"
#include "assert.h"
 
#include "mkdio.h"
 
void mkd_initialize  		_(( void ));
void mkd_with_html5_tags	_(( void ));
 
/* Replace the macro from encoding.h that refers to static 'rb_encoding_list' */
#ifdef ENC_FROM_ENCINDEX
#undef ENC_FROM_ENCINDEX
#define ENC_FROM_ENCINDEX(idx) (rb_enc_from_index(idx))
#endif

#endif
Conjugation answered 20/1, 2015 at 7:56 Comment(0)
A
0

There's a fork on github that already includes the patch:

https://github.com/drakontia/bluecloth

Alevin answered 16/10, 2015 at 19:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.