节俭的红宝石宝石

acib708

我一生无法成功运行“ 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

我已经在网上看到许多类似的错误,但没有找到解决方案。我正在运行OS X 10.9,并重新安装了rvm / ruby​​-2.0.0-p247。有任何想法吗?谢谢。

格雷戈尔·穆列兹

目前的问题可以在https://issues.apache.org/jira/browse/THRIFT-2219中找到

作为使用宝石的人们的一个临时解决方法,您可以尝试将_FORTIFY_SOURCE宏的#define设置为0,以使strlcpy成为函数而不是宏:

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

或者,如果您使用捆绑程序,则可以通过以下方式在本地设置节俭的cflag:

bundle config build.thrift --with-cppflags='-D_FORTIFY_SOURCE=0'

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章