运行gem install massive_record时失败

时间:2018-02-08 11:56:06

标签: ruby-on-rails ruby hbase

我想用HBase连接Rails,我想设置MassiveRecord,但我无法安装gem。 我跑了:gem install massive_record。 当我运行上述命令时,我有sudo特权。

我按照此处给出的说明进行操作:https://github.com/CompanyBook/massive_record/

我是ruby的新手,不知道如何处理此错误。难道我做错了什么? 错误:

    ERROR:  Error installing massive_record:
    ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.3.0/gems/thrift-0.6.0/ext
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20180208-14824-jzhruq.rb extconf.rb
checking for strlcpy() in string.h... yes
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-17/2.3.0/thrift-0.6.0/mkmf.log

current directory: /Library/Ruby/Gems/2.3.0/gems/thrift-0.6.0/ext
make "DESTDIR=" clean

current directory: /Library/Ruby/Gems/2.3.0/gems/thrift-0.6.0/ext
make "DESTDIR="
compiling binary_protocol_accelerated.c
compiling compact_protocol.c
compiling memory_buffer.c
compiling protocol.c
compiling thrift_native.c
compiling struct.c
struct.c:48:15: error: expected parameter declarator
extern size_t strlcpy(char *, const char *, size_t);
              ^
/usr/include/secure/_string.h:108:47: note: expanded from macro 'strlcpy'
                __builtin___strlcpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
                                                            ^
/usr/include/secure/_common.h:39:62: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > 1 ? 1 : 0)
                                                             ^
/usr/include/secure/_common.h:30:32: note: expanded from macro '_USE_FORTIFY_LEVEL'
#    define _USE_FORTIFY_LEVEL 2
                               ^
struct.c:48:15: error: expected ')'
/usr/include/secure/_string.h:108:47: note: expanded from macro 'strlcpy'
                __builtin___strlcpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
                                                            ^
/usr/include/secure/_common.h:39:62: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > 1 ? 1 : 0)
                                                             ^
/usr/include/secure/_common.h:30:32: note: expanded from macro '_USE_FORTIFY_LEVEL'
#    define _USE_FORTIFY_LEVEL 2
                               ^
struct.c:48:15: note: to match this '('
/usr/include/secure/_string.h:108:47: note: expanded from macro 'strlcpy'
                __builtin___strlcpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
                                                            ^
/usr/include/secure/_common.h:39:53: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > 1 ? 1 : 0)
                                                    ^
struct.c:48:15: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
extern size_t strlcpy(char *, const char *, size_t);
              ^
/usr/include/secure/_string.h:108:47: note: expanded from macro 'strlcpy'
                __builtin___strlcpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
                                                            ^
/usr/include/secure/_common.h:39:31: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > 1 ? 1 : 0)

4 errors generated.
make: *** [struct.o] Error 1

make failed, exit code 2

1 个答案:

答案 0 :(得分:0)

尝试运行以下命令,让我知道它是怎么回事!

gem install massive_record -- --with-cppflags=\"-D_FORTIFY_SOURCE=0 -Wno-shift-negative-value\"