在Mac OS X 10.11中安装Private_pub - 无法为http_parser.rb构建gem原生扩展

时间:2016-06-14 13:36:19

标签: ruby-on-rails macos private-pub

我尝试在我的Rails 4应用中安装private_pub。当我运行bundle install时遇到了这样的问题:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/serj/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20160614-8815-15skczg.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling ruby_http_parser.c
couldn't understand kern.osversion `15.5.0'
In file included from /Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/ruby.h:29,
                 from /Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby.h:33,
                 from ruby_http_parser.c:1:
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/defines.h:26:19: error: stdio.h: No such file or directory
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/defines.h:28:24: error: sys/types.h: No such file or directory
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/defines.h:31:23: error: sys/stat.h: No such file or directory
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/defines.h:34:21: error: stdlib.h: No such file or directory
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/defines.h:45:21: error: string.h: No such file or directory
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/defines.h:48:22: error: strings.h: No such file or directory
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/defines.h:51:23: error: inttypes.h: No such file or directory
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/defines.h:54:21: error: stdint.h: No such file or directory
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/defines.h:57:21: error: unistd.h: No such file or directory
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/defines.h:61:25: error: sys/select.h: No such file or directory
In file included from /Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/defines.h:68,
                 from /Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/ruby.h:29,
                 from /Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby.h:33,
                 from ruby_http_parser.c:1:
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/missing.h:23:45: error: math.h: No such file or directory
In file included from /Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/ruby.h:187,
                 from /Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby.h:33,
                 from ruby_http_parser.c:1:
/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/../lib/gcc/i686-apple-darwin11/4.2.1/include/limits.h:10:25: error: limits.h: No such file or directory
In file included from /Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/intern.h:35,
                 from /Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/ruby.h:1710,
                 from /Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby.h:33,
                 from ruby_http_parser.c:1:
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/st.h:142: error: expected declaration specifiers or ‘...’ before ‘uint32_t’
In file included from /Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/ruby.h:1710,
                 from /Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby.h:33,
                 from ruby_http_parser.c:1:
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/intern.h:353: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rb_fdset_t’
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/intern.h:454: error: expected declaration specifiers or ‘...’ before ‘rb_fdset_t’
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/intern.h:454: error: expected declaration specifiers or ‘...’ before ‘rb_fdset_t’
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/intern.h:454: error: expected declaration specifiers or ‘...’ before ‘rb_fdset_t’
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/intern.h:454: warning: ‘struct timeval’ declared inside parameter list
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/intern.h:454: warning: its scope is only this definition or declaration, which is probably not what you want
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/intern.h:455: warning: ‘struct timeval’ declared inside parameter list
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/intern.h:560: error: expected declaration specifiers or ‘...’ before ‘mode_t’
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/intern.h:639: error: expected declaration specifiers or ‘...’ before ‘pid_t’
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/intern.h:643: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rb_waitpid’
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/intern.h:644: error: expected ‘)’ before ‘pid’
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/intern.h:645: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rb_spawn’
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/intern.h:646: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rb_spawn_err’
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/intern.h:648: error: expected ‘)’ before ‘pid’
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/intern.h:763: error: expected declaration specifiers or ‘...’ before ‘uint32_t’
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/intern.h:912: error: expected ‘)’ before ‘long’
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/intern.h:913: error: expected ‘)’ before ‘long’
In file included from /Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby.h:33,
                 from ruby_http_parser.c:1:
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/ruby.h:1758: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rb_event_flag_t’
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/ruby.h:1759: error: expected ‘)’ before ‘evflag’
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/ruby.h:1762: error: expected ‘)’ before ‘func’
/Users/serj/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/ruby.h:1763: error: expected ‘)’ before ‘func’
In file included from ruby_http_parser.c:3:
ryah_http_parser.h:209: error: expected specifier-qualifier-list before ‘uint32_t’
ryah_http_parser.h:265: error: expected specifier-qualifier-list before ‘uint16_t’
ruby_http_parser.c: In function ‘ParserWrapper_init’:
ruby_http_parser.c:44: error: ‘ryah_http_parser’ has no member named ‘status_code’
ruby_http_parser.c:45: error: ‘ryah_http_parser’ has no member named ‘http_major’
ruby_http_parser.c:46: error: ‘ryah_http_parser’ has no member named ‘http_minor’
ruby_http_parser.c: In function ‘ParserWrapper_free’:
ruby_http_parser.c:77: warning: implicit declaration of function ‘free’
ruby_http_parser.c: In function ‘on_message_begin’:
ruby_http_parser.c:102: error: ‘ryah_http_parser’ has no member named ‘data’
ruby_http_parser.c:104: warning: implicit declaration of function ‘strlen’
ruby_http_parser.c:104: warning: incompatible implicit declaration of built-in function ‘strlen’
ruby_http_parser.c:106: warning: incompatible implicit declaration of built-in function ‘strlen’
ruby_http_parser.c:108: warning: ISO C90 forbids mixed declarations and code
ruby_http_parser.c: In function ‘on_url’:
ruby_http_parser.c:125: error: ‘ryah_http_parser’ has no member named ‘data’
ruby_http_parser.c: In function ‘on_header_field’:
ruby_http_parser.c:131: error: ‘ryah_http_parser’ has no member named ‘data’
ruby_http_parser.c: In function ‘on_header_value’:
ruby_http_parser.c:144: error: ‘ryah_http_parser’ has no member named ‘data’
ruby_http_parser.c:146: warning: ISO C90 forbids mixed declarations and code
ruby_http_parser.c:160: warning: incompatible implicit declaration of built-in function ‘strlen’
ruby_http_parser.c:162: warning: incompatible implicit declaration of built-in function ‘strlen’
ruby_http_parser.c:167: warning: incompatible implicit declaration of built-in function ‘strlen’
ruby_http_parser.c:169: warning: incompatible implicit declaration of built-in function ‘strlen’
ruby_http_parser.c:172: warning: incompatible implicit declaration of built-in function ‘strlen’
ruby_http_parser.c: In function ‘on_headers_complete’:
ruby_http_parser.c:190: error: ‘ryah_http_parser’ has no member named ‘data’
ruby_http_parser.c:192: warning: ISO C90 forbids mixed declarations and code
ruby_http_parser.c: In function ‘on_body’:
ruby_http_parser.c:211: error: ‘ryah_http_parser’ has no member named ‘data’
ruby_http_parser.c:213: warning: ISO C90 forbids mixed declarations and code
ruby_http_parser.c: In function ‘on_message_complete’:
ruby_http_parser.c:230: error: ‘ryah_http_parser’ has no member named ‘data’
ruby_http_parser.c:232: warning: ISO C90 forbids mixed declarations and code
ruby_http_parser.c: In function ‘Parser_alloc_by_type’:
ruby_http_parser.c:262: error: ‘ryah_http_parser’ has no member named ‘data’
ruby_http_parser.c: In function ‘Parser_execute’:
ruby_http_parser.c:314: warning: ISO C90 forbids mixed declarations and code
ruby_http_parser.c:320: warning: ISO C90 forbids mixed declarations and code
ruby_http_parser.c:322: error: ‘ryah_http_parser’ has no member named ‘upgrade’
ruby_http_parser.c: In function ‘Parser_upgrade_p’:
ruby_http_parser.c:381: error: ‘ryah_http_parser’ has no member named ‘upgrade’
ruby_http_parser.c: In function ‘Parser_http_version’:
ruby_http_parser.c:388: error: ‘ryah_http_parser’ has no member named ‘http_major’
ruby_http_parser.c:388: error: ‘ryah_http_parser’ has no member named ‘http_minor’
ruby_http_parser.c:391: error: ‘ryah_http_parser’ has no member named ‘http_major’
ruby_http_parser.c:391: error: ‘ryah_http_parser’ has no member named ‘http_minor’
ruby_http_parser.c: In function ‘Parser_http_major’:
ruby_http_parser.c:398: error: ‘ryah_http_parser’ has no member named ‘http_major’
ruby_http_parser.c:398: error: ‘ryah_http_parser’ has no member named ‘http_minor’
ruby_http_parser.c:401: error: ‘ryah_http_parser’ has no member named ‘http_major’
ruby_http_parser.c: In function ‘Parser_http_minor’:
ruby_http_parser.c:408: error: ‘ryah_http_parser’ has no member named ‘http_major’
ruby_http_parser.c:408: error: ‘ryah_http_parser’ has no member named ‘http_minor’
ruby_http_parser.c:411: error: ‘ryah_http_parser’ has no member named ‘http_minor’
ruby_http_parser.c: In function ‘Parser_http_method’:
ruby_http_parser.c:419: error: ‘ryah_http_parser’ has no member named ‘method’
ruby_http_parser.c:419: error: ‘ryah_http_parser’ has no member named ‘method’
ruby_http_parser.c:419: warning: incompatible implicit declaration of built-in function ‘strlen’
ruby_http_parser.c:419: error: ‘ryah_http_parser’ has no member named ‘method’
ruby_http_parser.c:419: error: ‘ryah_http_parser’ has no member named ‘method’
ruby_http_parser.c: In function ‘Parser_status_code’:
ruby_http_parser.c:428: error: ‘ryah_http_parser’ has no member named ‘status_code’
ruby_http_parser.c:429: error: ‘ryah_http_parser’ has no member named ‘status_code’
ruby_http_parser.c: In function ‘Parser_set_header_value_type’:
ruby_http_parser.c:451: warning: ISO C90 forbids mixed declarations and code
ruby_http_parser.c: In function ‘Init_ruby_http_parser’:
ruby_http_parser.c:473: warning: incompatible implicit declaration of built-in function ‘strlen’
ruby_http_parser.c:474: warning: incompatible implicit declaration of built-in function ‘strlen’
ruby_http_parser.c:475: warning: incompatible implicit declaration of built-in function ‘strlen’
ruby_http_parser.c:476: warning: incompatible implicit declaration of built-in function ‘strlen’
ruby_http_parser.c:477: warning: incompatible implicit declaration of built-in function ‘strlen’
ruby_http_parser.c:478: warning: incompatible implicit declaration of built-in function ‘strlen’
ruby_http_parser.c:479: warning: incompatible implicit declaration of built-in function ‘strlen’
ruby_http_parser.c:481: warning: incompatible implicit declaration of built-in function ‘strlen’
ruby_http_parser.c:482: warning: incompatible implicit declaration of built-in function ‘strlen’
ruby_http_parser.c:483: warning: incompatible implicit declaration of built-in function ‘strlen’
make: *** [ruby_http_parser.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/serj/.rvm/gems/ruby-2.2.1@email_platform/gems/http_parser.rb-0.6.0 for inspection.
Results logged to /Users/serj/.rvm/gems/ruby-2.2.1@email_platform/extensions/x86_64-darwin-13/2.2.0/http_parser.rb-0.6.0/gem_make.out
An error occurred while installing http_parser.rb (0.6.0), and Bundler cannot continue.
Make sure that `gem install http_parser.rb -v '0.6.0'` succeeds before bundling.

我该如何解决?

1 个答案:

答案 0 :(得分:2)

它非常奇怪,但正在运行:

$ xcode-select --install

修复了我的问题。我很惊讶自制软件没有要求我这样做(我之前使用命令行工具安装了Xcode,但我升级了操作系统)。

希望它能帮助别人!