用bundle安装Publify,在bluecloth gem上出错[英] Installing Publify with bundle install, error on bluecloth gem

本文是小编为大家收集整理的关于用bundle安装Publify,在bluecloth gem上出错的处理方法,想解了用bundle安装Publify,在bluecloth gem上出错的问题怎么解决?用bundle安装Publify,在bluecloth gem上出错问题的解决办法?那么可以参考本文帮助大家快速定位并解决问题。

问题描述

我正在尝试在 Windows 上为 Ruby on Rails 3.1 安装发布网络博客 CMS 6.0.9.

每次我尝试 bundle install Publify 时,安装 bluecloth gem 时都会收到相同的错误消息:

C:\Users\Lunasea\Downloads\typo-6.0.9>gem install 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:/RailsInstaller/Ruby1.9.2/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:/RailsInstaller/Ruby1.9.2/bin/ruby -e "puts 'EXPORTS', 'Init_bluecloth_ext'"
> bluecloth_ext-i386-mingw32.def
gcc -I. -IC:/RailsInstaller/Ruby1.9.2/include/ruby-1.9.1/i386-mingw32 -I/C/Rails
Installer/Ruby1.9.2/include/ruby-1.9.1/ruby/backward -I/C/RailsInstaller/Ruby1.9
.2/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-st
rings -Wno-missing-field-initializers -Wno-long-long -I.  -o bluecloth.o -c blue
cloth.c
In file included from c:\railsinstaller\devkit\mingw\bin\../lib/gcc/mingw32/4.5.
1/../../../../include/windows.h:48:0,
                 from c:\railsinstaller\devkit\mingw\bin\../lib/gcc/mingw32/4.5.
1/../../../../include/winsock2.h:22,
                 from c:/RailsInstaller/Ruby1.9.2/include/ruby-1.9.1/ruby/win32.
h:33,
                 from c:/RailsInstaller/Ruby1.9.2/include/ruby-1.9.1/ruby/define
s.h:205,
                 from c:/RailsInstaller/Ruby1.9.2/include/ruby-1.9.1/ruby/ruby.h
:74,
                 from c:/RailsInstaller/Ruby1.9.2/include/ruby-1.9.1/ruby.h:32,
                 from bluecloth.h:14,
                 from bluecloth.c:25:
c:\railsinstaller\devkit\mingw\bin\../lib/gcc/mingw32/4.5.1/../../../../include/
windef.h:229:23: error: duplicate 'unsigned'
c:\railsinstaller\devkit\mingw\bin\../lib/gcc/mingw32/4.5.1/../../../../include/
windef.h:238:23: error: duplicate 'unsigned'
c:\railsinstaller\devkit\mingw\bin\../lib/gcc/mingw32/4.5.1/../../../../include/
windef.h:238:23: error: two or more data types in declaration specifiers
c:\railsinstaller\devkit\mingw\bin\../lib/gcc/mingw32/4.5.1/../../../../include/
windef.h:241:24: error: duplicate 'unsigned'
make: *** [bluecloth.o] Error 1


Gem files will remain installed in C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9
.1/gems/bluecloth-2.2.0 for inspection.
Results logged to C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/bluecloth
-2.2.0/ext/gem_make.out

我已经尝试单独安装 gem 或者只是安装最新版本,但它总是给出相同的结果.

我正在使用标准生成的 database.yml.

推荐答案

2.2.0 中的头文件阻止bluecloth 在windows 上编译.但是,您可以自己修补它:

  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

本文地址:https://www.itbaoku.cn/post/786728.html