我正在尝试安装eventmachine,因此我可以运行此程序https://github.com/alexagranov/earnings_date_finder 看看它做了什么。
我收到此错误:
C:\Users\Dakota\Downloads\rails\rails_apps\earnings>ruby script/rails
Could not find eventmachine-0.12.10 in any of the sources
Run `bundle install` to install missing gems.
当我运行'bundle install'时,我得到了这个:
C:\Users\Dakota\Downloads\rails\rails_apps\earnings>bundle install
Fetching gem metadata from http://rubygems.org/.........
Fetching gem metadata from http://rubygems.org/..
Resolving dependencies...
Using rake (0.9.2.2)
Using abstract (1.0.0)
Using activesupport (3.0.11)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.11)
Using erubis (2.6.6)
Using rack (1.2.4)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.31)
Using actionpack (3.0.11)
Using mime-types (1.17.2)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.2.19)
Using actionmailer (3.0.11)
Using arel (2.0.10)
Using activerecord (3.0.11)
Using activeresource (3.0.11)
Using archive-tar-minitar (0.5.2)
Using bundler (1.3.5)
Using columnize (0.3.4)
Using daemons (1.1.4)
Installing eventmachine (0.12.10)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
.
C:/Users/Dakota/Downloads/rails/ruby/bin/ruby.exe extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h... *** 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:/Users/Dakota/Downloads/rails/ruby/bin/ruby
C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:431:in `try_do':
The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:546:
in `block in try_compile'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:499:
in `with_werror'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:546:
in `try_compile'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:736:
in `try_var'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:1023
:in `block in have_var'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:892:
in `block in checking_for'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:337:
in `block (2 levels) in postpone'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:307:
in `open'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:337:
in `block in postpone'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:307:
in `open'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:333:
in `postpone'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:891:
in `checking_for'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:1022
:in `have_var'
from extconf.rb:16:in `<main>'
Gem files will remain installed in C:/Users/hgc33_000/Downloads/rails/ruby/lib/r
uby/gems/2.0.0/gems/eventmachine-0.12.10 for inspection.
Results logged to C:/Users/hgc33_000/Downloads/rails/ruby/lib/ruby/gems/2.0.0/ge
ms/eventmachine-0.12.10/ext/gem_make.out
An error occurred while installing eventmachine (0.12.10), and Bundler cannot
continue.
Make sure that `gem install eventmachine -v '0.12.10'` succeeds before bundling.
我尝试了许多不同的方法来安装eventmachine,但每种方式都会给我带来同样的错误。
对于记录'gem install eventmachine --pre'给我这个错误:
C:\Users\Dakota\Downloads\rails\rails_apps\earnings>gem install eventmachine --pre
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing eventmachine:
ERROR: Failed to build gem native extension.
C:/Users/Dakota/Downloads/rails/ruby/bin/ruby.exe extconf.rb
checking for main() in -lssl... *** 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:/Users/Dakota/Downloads/rails/ruby/bin/ruby
--with-openssl-config
--without-openssl-config
--with-pkg-config
--without-pkg-config
--with-ssl-dir
--without-ssl-dir
--with-ssl-include
--without-ssl-include=${ssl-dir}/include
--with-ssl-lib
--without-ssl-lib=${ssl-dir}/
--with-ssllib
--without-ssllib
C:/Users/hgc33_000/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:431:in `try_do':
The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:516:
in `try_link0'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:531:
in `try_link'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:717:
in `try_func'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:947:
in `block in have_library'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:892:
in `block in checking_for'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:337:
in `block (2 levels) in postpone'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:307:
in `open'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:337:
in `block in postpone'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:307:
in `open'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:333:
in `postpone'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:891:
in `checking_for'
from C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/2.0.0/mkmf.rb:942:
in `have_library'
from extconf.rb:5:in `block in check_libs'
from extconf.rb:5:in `each'
from extconf.rb:5:in `all?'
from extconf.rb:5:in `check_libs'
from extconf.rb:39:in `manual_ssl_config'
from extconf.rb:61:in `<main>'
Gem files will remain installed in C:/Users/Dakota/Downloads/rails/ruby/lib/r
uby/gems/2.0.0/gems/eventmachine-1.0.3 for inspection.
Results logged to C:/Users/Dakota/Downloads/rails/ruby/lib/ruby/gems/2.0.0/ge
ms/eventmachine-1.0.3/ext/gem_make.out
答案 0 :(得分:6)
我可以安装它,执行以下步骤:
1)尝试了正常安装:
gem install eventmachine
它获取了gem的1.0.3版本,但是在make中失败了,因为变量声明变得混乱
2)编辑了文件:
c:\Ruby200-x64\lib\ruby\gems\2.0.0\gems\eventmachine-1.0.3\ext\project.h
并评论第97行
//typedef int pid_t;
3)然后,我打开了命令提示符,然后转到gem文件夹
c:\Ruby200-x64\lib\ruby\gems\2.0.0\gems\eventmachine-1.0.3
并且跑了:
gem build eventmachine.gemspec
4)它在文件夹上生成了一个eventmachine.gem文件...所以我将文件复制到c:\ tmp文件夹,然后转到那个文件夹,然后我输入了:
gem install eventmachine-1.0.3.gem --local
它安装成功!
答案 1 :(得分:0)
通过Reddit找到你了!
尝试使用预编译的 eventmachine gem
gem install eventmachine --pre
您遇到此问题是因为eventmachine gem(或其中一个依赖项)是用C语言编写的,需要由本地可用的C编译器(LLVM,GCC等)编译。
如果在gem文件中包含--pre
标志后继续出现此问题,我会卸载所有本地eventmachine版本并查看这些链接:
希望这有帮助!
答案 2 :(得分:0)
遵循Fera的步骤。 是的它现在安装了消息
Successfully installed eventmachine-1.0.3
1 gem installed
但不可用。
\ lib \ ruby \ gems \ 2.0.0 \ gems \ eventmachine-1.0.3 \ ext中的mkmf.log中出现错误,实际上没有任何内容构建
package configuration for openssl is not found
have_library: checking for main() in -lssl... -------------------- no