gem install t给出“无法构建gem本机扩展”

时间:2019-01-13 01:05:50

标签: ruby rubygems

我正在尝试在OSX High Sierra中安装t(Twitter的命令行工具)。我的Ruby版本是ruby 2.3.7p456。

但是我收到以下错误:     〜>宝石安装t

Building native extensions.  This could take a while...
ERROR:  Error installing t:
    ERROR: Failed to build gem native extension.

    /Users/akira/.rbenv/versions/2.2.1/bin/ruby -r ./siteconf20181213-96401-3tpab1.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling ryah_http_parser.c
In file included from ryah_http_parser.c:24:
In file included from ./ryah_http_parser.h:44:
In file included from /usr/local/include/stdint.h:59:
In file included from /usr/local/include/stdint.h:59:
....
/usr/local/include/stdint.h:2:10: error: #include nested too deeply
#include <stddef.h>
         ^
/usr/local/include/stdint.h:59:11: error: #include nested too deeply
# include <stdint.h>
          ^
/usr/local/include/stdint.h:72:11: error: #include nested too deeply
# include <sys/types.h>
          ^
In file included from ryah_http_parser.c:24:
./ryah_http_parser.h:210:3: error: unknown type name 'uint64_t'
  uint64_t content_length; /* # bytes in body (0 if no Content-Length header) */
  ^
In file included from ryah_http_parser.c:28:
In file included from /usr/include/stdlib.h:65:
In file included from /usr/include/sys/wait.h:110:
/usr/include/sys/resource.h:197:2: error: unknown type name 'uint64_t'
        uint64_t ri_user_time;
        ^
/usr/include/sys/resource.h:198:2: error: unknown type name 'uint64_t'
        uint64_t ri_system_time;
        ^
/usr/include/sys/resource.h:199:2: error: unknown type name 'uint64_t'
        uint64_t ri_pkg_idle_wkups;
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [ryah_http_parser.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/akira/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/http_parser.rb-0.6.0 for inspection.
Results logged to /Users/akira/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/http_parser.rb-0.6.0/gem_make.out

有人知道这是什么问题吗?

1 个答案:

答案 0 :(得分:0)

看起来您需要在osx上安装命令行开发工具。

运行xcode-select --install,然后重试。