1

安装 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
4

3 回答 3

2

茧宝石正在使用 Jeweler,它将 Rubinius 特定的宝石依赖项发送到 gemspec 中。从 gemspec 创建并期望安装在 MRI 上的 gem 包括这些依赖项。我已经提交了一个拉取请求来修复这个茧宝石:https ://github.com/nathanvda/cocoon/pull/184

一般来说,我建议在 gem 的源存储库中提交问题,因为可能不会提醒作者这里发布的问题。

于 2013-12-06T04:46:47.530 回答
1

Cocoon 1.2.4 有一个损坏的 gemspec,在不久之后发布的 1.2.5 中得到了修复。所以这应该现在就可以了。

于 2013-12-06T07:40:07.457 回答
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

祝你好运

于 2013-12-05T03:29:32.717 回答