Windows上的Hiredis 0.5.2

时间:2015-12-22 11:50:17

标签: ruby-on-rails redis gem install hiredis

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

    current directory: C:/Dev/Dependencies/Ruby/ruby-2.2.3-x64-mingw32/lib/ruby/gems/2.2.0/gems/hiredis-0.5.2/ext/hiredis_ext
C:/Dev/Dependencies/Ruby/ruby-2.2.3-x64-mingw32/bin/ruby.exe -r ./siteconf20151222-4124-nisefq.rb extconf.rb
gcc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb  net.c
net.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
net.c:35:24: fatal error: sys/socket.h: No such file or directory
compilation terminated.
make: *** [net.o] Error 1
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/Dev/Dependencies/Ruby/ruby-2.2.3-x64-mingw32/bin/$(RUBY_BASE_NAME)
extconf.rb:25:in `block in <main>': Building hiredis failed (RuntimeError)
        from extconf.rb:23:in `chdir'
        from extconf.rb:23:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in C:/Dev/Dependencies/Ruby/ruby-2.2.3-x64-mingw32/lib/ruby/gems/2.2.0/gems/hiredis-0.5.2 for inspection.
Results logged to C:/Dev/Dependencies/Ruby/ruby-2.2.3-x64-mingw32/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/hiredis-0.5.2/gem_make.out
An error occurred while installing hiredis (0.5.2), and Bundler cannot continue.
Make sure that `gem install hiredis -v '0.5.2'` succeeds before bundling.

人们说Windows不受支持,但extconf.rbmswin option ...

关于我应该做什么的任何想法?

1 个答案:

答案 0 :(得分:1)

坏消息:

hiredis目前无法在Windows上运行,Windows特定代码只是样板代码。虽然已经完成了一些工作并且有一些拉取请求(#52似乎是最相关的)但看起来这是一项艰巨的任务。

不幸的是,即使拉动请求也需要使用Visual Studio(而不是MinGW)进行编译,因此将来必须捆绑二进制文件并随hiredis Ruby gem一起提供。在使hiredis与Windows兼容之前,维护者还需要维护人员的长期承诺。

总而言之,它看起来不像hiredis可以很快安装在Windows上。

好消息:

hiredis gem是Ruby version of the Redis client的高效替代。如果无法加载,则会自动使用较慢的实现。您所要做的就是强制安装hiredis gem以实现gem依赖性。

gem install hiredis调用失败后,您可以按照in the gem install documentation所述手动编写gem规范:

例如,在lib\ruby\gems\2.2.0中,您可以运行:

gem spec cache\hiredis-0.5.2.gem --ruby > specifications\hiredis-0.5.2.gemspec

启动Rails 5应用程序时会收到警告,但除此之外应该有效。