13

私の人生では、「gem install thrift」を正常に実行することはできません.gemのネイティブ拡張を構築するときに失敗します。これは出力です:

(acib708) ~ -> gem install thrift
Building native extensions.  This could take a while...
ERROR:  Error installing thrift:
    ERROR: Failed to build gem native extension.

    /Users/acib708/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
extconf.rb:25:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
extconf.rb:25:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
checking for strlcpy() in string.h... yes
creating Makefile

make "DESTDIR="
compiling binary_protocol_accelerated.c
compiling bytes.c
compiling compact_protocol.c
compiling memory_buffer.c
compiling protocol.c
compiling strlcpy.c
                                           ^

(...)

In file included from strlcpy.c:20:
./strlcpy.h:28:15: error: conflicting types for '__builtin___strlcpy_chk'
/usr/include/secure/_string.h:105:3: note: expanded from macro 'strlcpy'
  __builtin___strlcpy_chk (dest, src, len, __darwin_obsz (dest))
  ^
./strlcpy.h:28:15: note: '__builtin___strlcpy_chk' is a builtin with type 'unsigned long (char *, const char *, unsigned long, unsigned long)'
/usr/include/secure/_string.h:105:3: note: expanded from macro 'strlcpy'
  __builtin___strlcpy_chk (dest, src, len, __darwin_obsz (dest))
  ^
4 errors generated.
make: *** [strlcpy.o] Error 1


Gem files will remain installed in /Users/acib708/.rvm/gems/ruby-2.0.0-p247/gems/thrift-0.9.1 for inspection.
Results logged to /Users/acib708/.rvm/gems/ruby-2.0.0-p247/gems/thrift-0.9.1/ext/gem_make.out

Web で同様のエラーをたくさん見ましたが、解決策が見つかりませんでした。rvm/ruby-2.0.0-p247 を新規インストールして、OS X 10.9 を実行しています。何か案は?ありがとう。

4

5 に答える 5

7

OS 10.9.4では、以下のコマンドが機能しました

bundle config build.thrift "--with-cppflags=-D_FORTIFY_SOURCE=0"
于 2014-07-25T22:03:05.733 に答える
3

cppflags で回避策を使用するのではなく、__has_builtin(strlcpy) をチェックする修正をコミットしました。システムでビルトインが利用できないが、strlcpy が定義されている場合は、以前と同じように externs を使用します。OS x 10.8、10.9、centos、ubuntu などで動作します。

于 2014-01-07T04:30:01.883 に答える
1

~/.bundle/configファイルを編集すると、次のようになります。

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

それは私のために働きます、ありがとう。

于 2016-10-10T07:20:02.003 に答える