Thrift install 0.9.3.0错误:无法构建gem原生扩展

时间:2016-04-05 22:16:00

标签: ruby-on-rails ruby rubygems thrift

使用 Ruby 2.0.0p648(2015-12-16修订版53162)[x86_64-darwin15.4.0]

我正在尝试安装Thrift,但遇到问题

Installing thrift 0.9.3.0 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/dericw/.rvm/rubies/ruby-2.0.0-p648/bin/ruby -r ./siteconf20160405-76400-1s15eu8.rb extconf.rb --with-cppflags=-D_FORTIFY_SOURCE=0
checking for strlcpy() in string.h... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling binary_protocol_accelerated.c
compiling bytes.c
compiling compact_protocol.c
compact_protocol.c:442:41: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
    rb_exc_raise(get_protocol_exception(INT2FIX(-1), rb_str_new2(buf)));
                                        ^~~~~~~~~~~
/Users/dericw/.rvm/rubies/ruby-2.0.0-p648/include/ruby-2.0.0/ruby/ruby.h:241:48: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
                            ~~~~~~~~~~~~~~~~~~~^
compact_protocol.c:451:41: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
    rb_exc_raise(get_protocol_exception(INT2FIX(-1), rb_str_new2(buf)));
                                        ^~~~~~~~~~~
/Users/dericw/.rvm/rubies/ruby-2.0.0-p648/include/ruby-2.0.0/ruby/ruby.h:241:48: note: expanded from macro 'INT2FIX'
#define INT2FIX(i) ((VALUE)(((SIGNED_VALUE)(i))<<1 | FIXNUM_FLAG))
                            ~~~~~~~~~~~~~~~~~~~^
2 errors generated.
make: *** [compact_protocol.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/dericw/.rvm/gems/ruby-2.0.0-p648/gems/thrift-0.9.3.0 for inspection.
Results logged to /Users/dericw/.rvm/gems/ruby-2.0.0-p648/extensions/x86_64-darwin-15/2.0.0/thrift-0.9.3.0/gem_make.out

我尝试使用此命令

gem install thrift -- --with-cppflags='-D_FORTIFY_SOURCE=0'

并且没有用,所以我尝试了这个,

bundle config build.thrift --with-cppflags='-D_FORTIFY_SOURCE=0'

在我尝试bundle install后,它会出现同样的错误。

我在 Mac OS X El Capitan 10.11.4 上运行此功能。有谁知道如何解决这个问题?谢谢!

0 个答案:

没有答案