0

Using Ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-darwin15.4.0]

I am trying to install Thrift but having issues with it

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

I tried to using this command

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

and that didn't work so I tried this one,

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

And after I try to bundle install it gives the same error.

I am running this on Mac OS X El Capitan 10.11.4. Anyone know how to solve this? Thank you!

The Nomad
  • 7,155
  • 14
  • 65
  • 100
  • Have installed `boost` and `libevent`? If not, install them with `brew install boost` and `brew install libevent`. – Ashish Bista Apr 05 '16 at 22:25
  • @AshishBista just installed both and ran it again, but same issue. – The Nomad Apr 05 '16 at 22:31
  • @JensG this is not a duplicate. I believe it relates to an issue described in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=202660 with ruby.h on ruby versions < 2.2 – giladbu Apr 07 '16 at 06:25
  • 6
    The same error seems to have been present in this question [Can't install thrift gem on OS X El Capitan](http://stackoverflow.com/questions/36378190/cant-install-thrift-gem-on-os-x-el-capitan). There is an answer suggestion in the comments, that worked for me. – Laura Paakkinen Apr 07 '16 at 14:53
  • Please refer the post for answer to the mentioned question : http://stackoverflow.com/questions/36378190/cant-install-thrift-gem-on-os-x-el-capitan – Satish Apr 10 '16 at 07:16
  • Please try this. It worked for me. ```gem install thrift -v 0.9.3 -- --with-cppflags=\"-D_FORTIFY_SOURCE=0 -Wno-shift-negative-value\"``` – Piyush Singal Mar 25 '21 at 07:54

0 Answers0