Rails gem安装错误 - 茧

时间:2013-12-05 03:01:33

标签: ruby-on-rails cocoon-gem

我在安装coccon gem时遇到此错误。有没有人有同样的问题? 我正在使用Ruby 2.0.0p353,Rails 4.0和RVM

ERROR:  Error installing cocoon:
ERROR: Failed to build gem native extension.

    /home/user/.rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb
checking for st.h... yes
creating Makefile

make
compiling handler.c
compiling gram.c
compiling token.c
token.re: In function ‘sycklex_yaml_utf8’:
token.re:541:36: warning: variable ‘lvl’ set but not used [-Wunused-but-set-variable]
compiling syck.c
compiling rubyext.c
rubyext.c: In function ‘mktime_do’:
rubyext.c:292:19: warning: unused variable ‘offset’ [-Wunused-variable]
rubyext.c: In function ‘rb_syck_load_handler’:
rubyext.c:664:5: warning: implicit declaration of function ‘rb_hash_size’ [-Wimplicit-       function-declaration]
rubyext.c: In function ‘rb_syck_err_handler’:
rubyext.c:684:12: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘long int’ [-Wformat]
rubyext.c: In function ‘syck_const_find’:
rubyext.c:1047:5: warning: implicit declaration of function ‘rb_ary_size’ [-Wimplicit-function-declaration]
rubyext.c: In function ‘syck_scalar_value_set’:
rubyext.c:1481:27: error: ‘struct RString’ has no member named ‘ptr’
rubyext.c: In function ‘syck_seq_initialize’:
rubyext.c:1509:15: warning: variable ‘node’ set but not used [-Wunused-but-set-variable]
rubyext.c: In function ‘syck_node_type_id_set’:
rubyext.c:1741:25: error: ‘struct RString’ has no member named ‘ptr’
make: *** [rubyext.o] Error 1

3 个答案:

答案 0 :(得分:2)

茧宝石正在使用珠宝商,它将特定于Rubinius的宝石依赖性发射到gemspec中。从gemspec创建并预计将安装在MRI上的gem包括那些依赖项。我已经提交了一个拉取请求,以解决这个问题:https://github.com/nathanvda/cocoon/pull/184

一般情况下,我建议在gem的源存储库中提交问题,因为作者可能不会收到此处发布的问题的警报。

答案 1 :(得分:1)

Cocoon 1.2.4有一个破碎的gemspec,固定在1.2.5,不久后发布。所以这应该现在就可以了。

答案 2 :(得分:0)

# cd /path/rubysl-yaml-2.0.4
# vi ext/rubysl/syck/rubyext.c

更改(RSRING - > RSTRING_PTR)

#define syck_copy_string(val) syck_strndup(RSTRING(val)->ptr, RSTRING_LEN(val))

#define syck_copy_string(val) syck_strndup(RSTRING_PTR(val)->ptr, RSTRING_LEN(val))

和gem构建并安装

# gem build rubysl-yaml.gemspec && gem install rubysl-yaml-2.0.4.gem
祝你好运