我一直在尝试使用 homebrew 安装 msgpack,但它反复抛出以下错误:
Building native extensions. This could take a while...
ERROR: Error installing msgpack:
ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.4.0/gems/msgpack
0.5.8/ext/msgpack
/usr/local/opt/ruby/bin/ruby -r ./siteconf20170801-23901-1ar0ojr.rb extconf.rb
checking for ruby/st.h... yes
checking for st.h... yes
checking for rb_str_replace() in ruby.h... yes
creating Makefile
current directory: /usr/local/lib/ruby/gems/2.4.0/gems/msgpack-
0.5.8/ext/msgpack
make "DESTDIR=" clean
current directory: /usr/local/lib/ruby/gems/2.4.0/gems/msgpack-
0.5.8/ext/msgpack
make "DESTDIR="
compiling buffer.c
compiling buffer_class.c
compiling core_ext.c
core_ext.c:121:22: error: use of undeclared identifier 'rb_cFixnum'
rb_define_method(rb_cFixnum, "to_msgpack", Fixnum_to_msgpack, -1);
^
core_ext.c:122:22: error: use of undeclared identifier 'rb_cBignum'
rb_define_method(rb_cBignum, "to_msgpack", Bignum_to_msgpack, -1);
^
2 errors generated.
make: *** [core_ext.o] Error 1
make failed, exit code 2
Gem files will remain installed in
/usr/local/lib/ruby/gems/2.4.0/gems/msgpack-0.5.8 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-
16/2.4.0/msgpack-0.5.8/gem_make.out
寻找解决方案一直没有结果。我的Ruby版本是2.4.1,但我不确定是否是版本问题。
最佳答案
我在 Github 的 msgpack 存储库中发现了这个问题:
https://github.com/msgpack/msgpack-ruby/issues/120
看来这个问题已在版本 1.0.0 中得到解决。
您真的需要使用 0.5.8 版本吗? gem版本可以更新吗?
关于ruby - 使用 Homebrew 程序安装 msgpack (0.5.8) mac OSX 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45443135/