为什么这些红宝石宝石会被编译?

时间:2015-08-22 21:10:40

标签: ruby compilation gem

我尝试安装几个版本的jekyll,但奇怪的是它们无法编译。第一颗宝石是jekyll 1.5.1所要求的。这是它的错误:

$ gem install fast-stemmer
Building native extensions.  This could take a while...
ERROR:  Error installing fast-stemmer:
        ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb
creating Makefile

make
compiling porter.c
porter.c: In function ‘step5’:
porter.c:359:7: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
compiling porter_wrap.c
porter_wrap.c: In function ‘stem_word’:
porter_wrap.c:20:17: warning: unused variable ‘i’ [-Wunused-variable]
linking shared-object stemmer.so

make install
/usr/bin/install -c -m 0755 stemmer.so /home/user/.gem/gems/fast-stemmer-1.0.2/lib
installing default stemmer libraries


Gem files will remain installed in /home/user/.gem/gems/fast-stemmer-1.0.2 for inspection.
Results logged to /home/user/.gem/gems/fast-stemmer-1.0.2/ext/gem_make.out

尝试安装最新版本的jekyll也会失败:

$ gem install jekyll
Fetching: liquid-2.6.3.gem (100%)
Fetching: kramdown-1.8.0.gem (100%)
Fetching: mercenary-0.3.5.gem (100%)
Fetching: safe_yaml-1.0.4.gem (100%)
Fetching: colorator-0.1.gem (100%)
Fetching: yajl-ruby-1.2.1.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing jekyll:
        ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb
creating Makefile

make
compiling yajl.c
compiling yajl_alloc.c
compiling yajl_buf.c
compiling yajl_encode.c
compiling yajl_ext.c
yajl_ext.c: In function ‘rb_yajl_parser_parse’:
yajl_ext.c:471:17: warning: variable ‘stat’ set but not used [-Wunused-but-set-variable]
compiling yajl_gen.c
compiling yajl_lex.c
compiling yajl_parser.c
compiling yajl_version.c
linking shared-object yajl/yajl.so

make install
/usr/bin/install -c -m 0755 yajl.so /home/user/.gem/gems/yajl-ruby-1.2.1/lib/yajl
installing default yajl libraries


Gem files will remain installed in /home/user/.gem/gems/yajl-ruby-1.2.1 for inspection.
Results logged to /home/user/.gem/gems/yajl-ruby-1.2.1/ext/yajl/gem_make.out

1 个答案:

答案 0 :(得分:0)

问题是由于脚本在编译步骤中选择-Werror。使用gem前缀DEBUG=false命令允许编译成功:

DEBUG=false gem install jekyll -v 1.5.1 --no-ri --no-rdoc