windows 下安装部分gem时出现 Could not create Makefile due to some reason 的解决办法
来源:互联网 发布:java技术总监年薪多少 编辑:程序博客网 时间:2024/06/07 05:28
现象描述:
如果你安装某个需要本地编译代码的gem 时出现了类似如下的错误,则符合本文章所谈论的情况:
C:/Develop/Ruby193/bin/ruby.exe extconf.rb checking for asprintf()... *** extconf.rb failed ***Could not create Makefile due to some reason, probably lack ofnecessary libraries and/or headers. Check the mkmf.log file for moredetails. 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:/Develop/Ruby193/bin/rubyC:/Develop/Ruby193/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)You have to install development tools first.from C:/Develop/Ruby193/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'from C:/Develop/Ruby193/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'from C:/Develop/Ruby193/lib/ruby/1.9.1/mkmf.rb:619:in `try_func'from C:/Develop/Ruby193/lib/ruby/1.9.1/mkmf.rb:894:in `block in have_func'from C:/Develop/Ruby193/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'from C:/Develop/Ruby193/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'from C:/Develop/Ruby193/lib/ruby/1.9.1/mkmf.rb:254:in `open'from C:/Develop/Ruby193/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'from C:/Develop/Ruby193/lib/ruby/1.9.1/mkmf.rb:254:in `open'from C:/Develop/Ruby193/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'from C:/Develop/Ruby193/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'from C:/Develop/Ruby193/lib/ruby/1.9.1/mkmf.rb:893:in `have_func'from extconf.rb:3:in `<main>'
mkmf.log中的内容是:
"gcc -o conftest -IC:/Develop/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Develop/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Develop/Ruby193/include/ruby-1.9.1 -I. -DFD_SETSIZE=2048 -DFD_SETSIZE=2048 -O3 -fno-omit-frame-pointer -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c -L. -LC:/Develop/Ruby193/lib -L. -lmsvcrt-ruby191 -lshell32 -lws2_32 -limagehlp -lshlwapi "In file included from C:/Develop/Ruby193/include/ruby-1.9.1/ruby.h:32:0, from conftest.c:1:C:/Develop/Ruby193/include/ruby-1.9.1/ruby/ruby.h:109:14: error: size of array 'ruby_check_sizeof_voidp' is negativeIn file included from C:/Develop/Ruby193/include/ruby-1.9.1/ruby.h:32:0, from conftest.c:1:C:/Develop/Ruby193/include/ruby-1.9.1/ruby/ruby.h: In function 'rb_class_of':C:/Develop/Ruby193/include/ruby-1.9.1/ruby/ruby.h:1333:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]C:/Develop/Ruby193/include/ruby-1.9.1/ruby/ruby.h: In function 'rb_type':C:/Develop/Ruby193/include/ruby-1.9.1/ruby/ruby.h:1349:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]In file included from C:/Develop/Ruby193/include/ruby-1.9.1/ruby/ruby.h:1381:0, from C:/Develop/Ruby193/include/ruby-1.9.1/ruby.h:32, from conftest.c:1:C:/Develop/Ruby193/include/ruby-1.9.1/ruby/missing.h: At top level:C:/Develop/Ruby193/include/ruby-1.9.1/ruby/missing.h:41:8: error: redefinition of 'struct timespec'In file included from c:\develop\devkit\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/include/process.h:12:0, from C:/Develop/Ruby193/include/ruby-1.9.1/ruby/win32.h:62, from C:/Develop/Ruby193/include/ruby-1.9.1/ruby/defines.h:223, from C:/Develop/Ruby193/include/ruby-1.9.1/ruby/ruby.h:67, from C:/Develop/Ruby193/include/ruby-1.9.1/ruby.h:32, from conftest.c:1:c:\develop\devkit\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/include/sys/types.h:89:8: note: originally defined hereIn file included from C:/Develop/Ruby193/include/ruby-1.9.1/ruby/ruby.h:1381:0, from C:/Develop/Ruby193/include/ruby-1.9.1/ruby.h:32, from conftest.c:1:C:/Develop/Ruby193/include/ruby-1.9.1/ruby/missing.h:48:8: error: redefinition of 'struct timezone'In file included from C:/Develop/Ruby193/include/ruby-1.9.1/ruby/win32.h:63:0, from C:/Develop/Ruby193/include/ruby-1.9.1/ruby/defines.h:223, from C:/Develop/Ruby193/include/ruby-1.9.1/ruby/ruby.h:67, from C:/Develop/Ruby193/include/ruby-1.9.1/ruby.h:32, from conftest.c:1:c:\develop\devkit\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/include/time.h:260:8: note: originally defined herechecked program was:/* begin */1: #include "ruby.h"2: 3: #include <winsock2.h>4: #include <windows.h>5: int main() {return 0;}/* end */
问题原因和解决办法:
可能你安装了和你使用的Ruby版本不对应的Devkit。
参考 http://rubyinstaller.org/downloads/ ,页面上有这样几行
WHICH DEVELOPMENT KIT?Down this page, several and different versions of Development Kits (DevKit) are listed. Please download the right one for your version of Ruby:Ruby 1.8.6 to 1.9.3: tdm-32-4.5.2Ruby 2.0.0: mingw64-32-4.7.2Ruby 2.0.0 x64 (64bits): mingw64-64-4.7.2请下载和安装正确的DevKit
相关问题链接:
如果你在试图安装mysql有关的gem时出现类似问题,请阅读这篇帖子,看看是否能对你的问题有帮助。
http://www.ruby-forum.com/topic/1112530
另外,rubyinstaller也提供了很多有用的TroubleShooting
https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting#wiki-gems_fails_comspec_autorun
https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting#dll-conflicts-with-devkit-cause-native-gem-install-failures
- windows 下安装部分gem时出现 Could not create Makefile due to some reason 的解决办法
- *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not
- Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not
- Windows下执行gem install 时ERROR: Failed to build gem native extension的解决办法.
- 【Rails】用gem安装MySQL组件出现Failed to build gem native extension错误的解决办法
- 出现Could not allocate CursorWindow of size due to error -12.错误的解决方案
- Ubuntu下,通过gem安装mysql时,出现Failed to build gem native extension.错误的解决方法
- 安装VMware出现Error 1406:could not write value installpath to key的解决办法
- 安装了ansys 后出现错误提示: could not create the file required to ......
- 解决:Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could
- *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could no
- 解决:Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could
- Struts2中Could not create and/or set value back on to object的解决办法
- 出现Terminating app due to uncaught exception 'NSUnknownKeyException', reason: 错误的解决方法
- 安装cocoapods时出现could not stat active Xcode path的解决办法
- 安装、重装MySQL时,出现could not start the service mysql error:0的解决办法
- 【luajit,export有效】安装cocoapods时出现could not stat active Xcode path的解决办法
- 安装cocoapods时出现could not stat active Xcode path的解决办法
- Shiro 是 JAVA 世界中新近出现的权限框架
- redhat linux下nfs的配置及操作
- 【黑马程序员】水晶报表(推模式)(学习笔记)
- SIM May not be in stable state.....
- 彻底删除SQLServer2005
- windows 下安装部分gem时出现 Could not create Makefile due to some reason 的解决办法
- 做管理需要放弃技术吗?
- Weathermap v0.97b Configuration Reference
- 字符&字符串
- 9个有趣的心理学现象
- 数据结构复习资料
- 温度和芯片供电电压影响芯片的速度和性能
- win server 2012 安装记录
- Linux nm 用法