1
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オプションがあります...

私が何をすべきかについてのアイデアはありますか?

4

1 に答える 1

1

悪いニュース:

現在、hiredis は Windows では動作しません。Windows 固有のコードは単なるボイラープレート コードです。いくつかの作業が行われ、いくつかのプル リクエスト ( #52が最も関連性が高いようです) がありますが、それは難しい作業のようです。

残念ながら、そのプル リクエストでも (MinGW ではなく) Visual Studio でコンパイルする必要があるため、将来的にはバイナリをバンドルして、hiredis Ruby gem に同梱する必要があります。また、メンテナーは、hiredis を Windows と互換性を持たせる前に、メンテナーの長期的なコミットメントを必要とします。

全体として、hiredis をすぐに Windows にインストールできるようには見えません。

良いニュース:

hiredis gem は、Redis クライアントのRuby バージョンの高性能な代替品です。ロードできない場合は、低速の実装が自動的に使用されます。必要なのは、hiredis gem を強制的にインストールして、gem の依存関係を満たすことだけです。

呼び出しが失敗した後、ドキュメントに記載されているgem install hiredisように、gem 仕様を手動で記述できます。gem install

たとえば、lib\ruby\gems\2.2.0次を実行できます。

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

Rails 5 アプリケーションを起動すると警告が表示されますが、それ以外は問題なく動作するはずです。

于 2016-01-03T12:58:48.203 に答える