[英]Can't install thrift gem on OS X El Capitan
在 OSX El Capitan 升級后嘗試安裝 thift 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)));
^~~~~~~~~~~
編譯失敗,compact_protocol.c:442:41: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
我有辦法給你! 希望。
前幾天有同樣的問題。
問題出在 El Capitan 捆綁的 clang 編譯器中。 我敢肯定它會搞砸其他問題,但這是我遇到很多問題的一點。
嘗試運行以下命令,讓我知道它是怎么回事!
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"
這在 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"
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"
嘗試這個
gem install thrift -v '0.9.0' -- --with-cppflags='-D_FORTIFY_SOURCE=0'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.