无法在OS X El Capitan上安装 gem?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (2)
  • 关注 (0)
  • 查看 (87)

在OSX El Capitan升级后安装Thunder Gem:

    $ 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)));
                                            ^~~~~~~~~~~

编译失败error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]

提问于
用户回答回答于

运行下面的命令,查看错误

gem install thrift -- --with-cppflags=\"-D_FORTIFY_SOURCE=0 -Wno-shift-negative-value\"
用户回答回答于

你需要转义双引号。

$ 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”

扫码关注云+社区

领取腾讯云代金券