本文介绍了在Windows上安装捆绑软件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用原生扩展安装hiredis(0.3.2)当我尝试运行bundle install时,出现此错误:
Gem :: Installer :: ExtensionBuildError:错误:无法构建gem本机扩展。
C:/RailsInstaller/Ruby1.9.2/bin/ruby.exe extconf.rb
gcc -std = c99 -pedantic -c -O3 -fPIC -Wall -W -Wstrict-prototypes -wwrite-strings -g -ggdb net.c
net.c:1:0:警告:-fPIC目标被忽略(所有代码都是位置独立的)
net.c:35:24:fatal错误:sys / socket.h:没有这样的文件或目录
编译终止。
make:*** [net.o]错误1
创建Makefile
$ b $ make
C:/RailsInstaller/Ruby1.9.2/bin/ruby -e放入'EXPORTS','Init_hiredis_ext'> hiredis_ext-i386-mingw32.def
gcc -I。 -IC:/RailsInstaller/Ruby1.9.2/include/ruby-1.9.1/i386-mingw32 -I / C / RailsInstaller / Ruby1.9.2 / include / ruby-1.9.1 / ruby / backward -I / C / RailsInstaller / Ruby1.9.2 / include / ruby-1.9.1 -I。 -O3 -g -Wextra -Wno-unused-parameter -Wno-括号-Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -IC:/RailsInstaller/Ruby1.9.2/lib/ ruby / gems / 1.9.1 / gems / hiredis-0.3.2 / vendor / hiredis -o connection.o -c connection.c
connection.c:1:24:致命错误:sys / socket.h:没有这样的文件或目录
编译终止。
make:*** [connection.o]错误1
Gem文件将保持安装在C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9 .1 / gems / hiredis-0.3.2进行检查。
记录到C的结果:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/hiredis-0.3.2/ext/hiredis_ext/gem_make.out
安装时发生错误hiredis(0.3.2)和Bundler无法继续。
确保`gem install hiredis -v'0.3.2'`捆绑成功。
处理完成退出代码5
我的gemfile是:
source'http://rubygems.org'
gem'rails' ,'3.1.1'
#Bundle edge Rails改为:
#gem'rails',:git => 'git://github.com/rails/rails.git'
gem'sqlite3'
gemrake,0.8.7
gemmysql
#默认情况下,Gems仅用于资产,并且在生产环境中不需要
#。
group:assets do
gem'sass-rails','〜> 3.1.4'
gem'咖啡栏','〜> 3.1.1'
gem'uglifier','> = 1.0.3'
end
gem'devise'
gem'execjs'
gem'therubyracer'
gem'jquery-rails','> = 1.0.12'
gem'faye'
# ActiveModel has_secure_password
#gem'bcrypt-ruby','〜> 3.0.0'
#使用独角兽作为web服务器
#gem'unicorn'
#使用Capistrano部署
#gem'capistrano'
#使用调试器
#gem'ruby-debug19',:require => 'ruby-debug'
group:test do
#漂亮的打印测试输出
gem'turn',:require => false
end
解决方案
Hiredis 确实而不是在Windows上工作。有几个建议的补丁可以解决这个问题,但没有一个获得批准:
When i try to run bundle install, i got this error :
Installing hiredis (0.3.2) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby1.9.2/bin/ruby.exe 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)
net.c:35:24: fatal error: sys/socket.h: No such file or directory
compilation terminated.
make: *** [net.o] Error 1
creating Makefile
make
C:/RailsInstaller/Ruby1.9.2/bin/ruby -e "puts 'EXPORTS', 'Init_hiredis_ext'" > hiredis_ext-i386-mingw32.def
gcc -I. -IC:/RailsInstaller/Ruby1.9.2/include/ruby-1.9.1/i386-mingw32 -I/C/RailsInstaller/Ruby1.9.2/include/ruby-1.9.1/ruby/backward -I/C/RailsInstaller/Ruby1.9.2/include/ruby-1.9.1 -I. -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -IC:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/hiredis-0.3.2/vendor/hiredis -o connection.o -c 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 C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/hiredis-0.3.2 for inspection.
Results logged to C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/hiredis-0.3.2/ext/hiredis_ext/gem_make.out
An error occured while installing hiredis (0.3.2), and Bundler cannot continue.
Make sure that `gem install hiredis -v '0.3.2'` succeeds before bundling.
Process finished with exit code 5
My gemfile is :
source 'http://rubygems.org'
gem 'rails', '3.1.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem "rake", "0.8.7"
gem "mysql"
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.1.4'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'devise'
gem 'execjs'
gem 'therubyracer'
gem 'jquery-rails', '>= 1.0.12'
gem 'faye'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
group :test do
# Pretty printed test output
gem 'turn', :require => false
end
解决方案
Hiredis does not work on Windows. There are several proposed patches that will fix it but none has been approved:
- https://github.com/redis/hiredis/pull/52
- https://github.com/redis/hiredis/pull/48
- https://github.com/redis/hiredis/issues/42
这篇关于在Windows上安装捆绑软件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!