Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

ruby - 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]

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...