Anton
Anton

Reputation: 905

Can't install thrift gem on OS X El Capitan

Trying to install thift gem after OSX El Capitan upgrade:

    $ gem install thrift
    Building native extensions.  This could take a while...
    ERROR:  Error installing thrift:
        ERROR: Failed to build gem native extension.

        /Users/foo/.rvm/rubies/ruby-2.1.4/bin/ruby -r ./siteconf20160402-32256-7dzqel.rb extconf.rb
    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)));
                                            ^~~~~~~~~~~

Compilation fails with compact_protocol.c:442:41: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]

Upvotes: 21

Views: 9561

Answers (5)

Pratik Agarwal
Pratik Agarwal

Reputation: 11

This worked for me on mac bigsur

gem install thrift -v '0.10.0.0' -- --with-cppflags="-D_FORTIFY_SOURCE=0 -Wno-shift-negative-value -Wno-compound-token-split-by-macro" 

Upvotes: 1

Dmytro Stekanov
Dmytro Stekanov

Reputation: 136

There is help for Big Sur https://github.com/instructure/canvas-lms/issues/827#issuecomment-946388555

gem install thrift -v 0.15.0 -- --with-cppflags="-Wno-compound-token-split-by-macro"

Upvotes: 11

Ishwar
Ishwar

Reputation: 11

Try this

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

Upvotes: -1

Valdis Vitayaudom
Valdis Vitayaudom

Reputation: 309

You need to escape double quotes.

$ bundle config build.thrift "--with-cppflags=\"-D_FORTIFY_SOURCE=0 -Wno-shift-negative-value\""

$ cat ~/.bundle/config

BUNDLE_BUILD__THRIFT: --with-cppflags="-D_FORTIFY_SOURCE=0 -Wno-shift-negative-value"

Upvotes: 20

nobody
nobody

Reputation: 8263

I have a solution for you! Hopefully.

Had this same problem the other day.

The problem is in the clang compiler that El Capitan comes bundled with. I'm sure it screws up other issues but this is one point that I had a lot of issues with.

Try running the following command and let me know how it goes!

gem install thrift -- --with-cppflags=\"-D_FORTIFY_SOURCE=0 -Wno-shift-negative-value\"

Upvotes: 63

Related Questions