新手问题 安装 hiredis 总是不成功

bovvic · 2013年02月16日 · 最后由 Lax 回复于 2017年08月06日 · 10367 次阅读

以致出现如下错误,望各位大大帮忙


Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        D:/Software/ruby/bin/ruby.exe extconf.rb 
      0 [main] sh 7192 open_stackdumpfile: Dumping stack trace to sh.exe.stackdump
      0 [main] sh 9144 open_stackdumpfile: Dumping stack trace to sh.exe.stackdump
std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb net.c
/bin/sh: -pedantic: command not found
make: [net.o] Error 127 (ignored)
std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb hiredis.c
/bin/sh: -pedantic: command not found
make: [hiredis.o] Error 127 (ignored)
std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb sds.c
/bin/sh: -pedantic: command not found
make: [sds.o] Error 127 (ignored)
std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb async.c
/bin/sh: -pedantic: command not found
make: [async.o] Error 127 (ignored)
ar rcs libhiredis.a net.o hiredis.o sds.o async.o
D:\Software\ruby\DevKit\mingw\bin\ar.exe: net.o: No such file or directory
make: *** [libhiredis.a] Error 1
creating Makefile

make
generating hiredis_ext-i386-mingw32.def
compiling connection.c
connection.c:1:24: fatal error: sys/socket.h: No such file or directory
compilation terminated.
make: *** [connection.o] Error 1


Gem files will remain installed in D:/Software/ruby/lib/ruby/gems/1.9.1/gems/hiredis-0.4.5 for inspection.
Results logged to D:/Software/ruby/lib/ruby/gems/1.9.1/gems/hiredis-0.4.5/ext/hiredis_ext/gem_make.out
An error occurred while installing hiredis (0.4.5), and Bundler cannot continue.
Make sure that `gem install hiredis -v '0.4.5'` succeeds before bundling.
~ $ gem install hiredis
Fetching: hiredis-0.4.5.gem (100%)
Building native extensions.  This could take a while...
Successfully installed hiredis-0.4.5
1 gem installed

在 Mac 下面没有问题。 错误信息说没有找到 sys/socket.h 这个头文件,估计这个东西还是得 Linux/mac 上用 GCC 编译。

Hiredis is not compatible with Windows.

https://github.com/lgsonic/hiredis-win <--- try this thing

#2 楼 @blacktulip 直接修改 gemfile 可以不?

想问下楼主这个问题现在解决掉了么,我为了安装 gem websocket_rails 也遇到了这个问题

刚遇到类似问题,发现没有装 make。(有 gcc) 也是很费解

checking for sys/socket.h... yes
*** 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.
需要 登录 后方可回复, 如果你还没有账号请 注册新账号