为什么这些红宝石宝石不会编译?(Why won't these ruby gems compile?)

编程入门 行业动态 更新时间:2024-10-26 08:22:05
为什么这些红宝石宝石不会编译?(Why won't these ruby gems compile?)

我尝试安装几个版本的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

I tried installing a couple versions of jekyll, but they strangely fail compilation. The first gem is required by jekyll 1.5.1. Here are its errors:

$ 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

Attempts to install the most recent version of jekyll also fail:

$ 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

最满意答案

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

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

The problem is due to scripts selecting -Werror during the compilation step. Prefixing the gem command with DEBUG=false allowed the compilation to succeed:

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

更多推荐

本文发布于:2023-07-15 19:12:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1117686.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:红宝石   ruby   compile   gems

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!