1

我正在尝试安装 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.

当我运行“捆绑安装”时,我得到了这个:

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
4

3 回答 3

6

我可以安装它,执行以下步骤:

1)尝试正常安装:

gem install eventmachine

它获取了 gem 的 1.0.3 版本,但由于变量声明 conflit 而在 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 文件...所以我将一个文件复制到 ac:\tmp 文件夹,然后转到该文件夹​​,然后从那里输入:

gem install eventmachine-1.0.3.gem --local

并且安装成功!

于 2013-06-30T02:45:05.983 回答
0

按照费拉的步骤。是的,它现在确实安装了消息

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
于 2013-08-28T19:41:41.347 回答
0

通过 Reddit 找到你!

尝试使用预编译的eventmachine gem

gem install eventmachine --pre

您遇到此问题是因为 eventmachine gem(或其依赖项之一)是用 C 编写的,需要由本地可用的 C 编译器(LLVM、GCC 等)编译。

如果--pre在 gemfile 中包含该标志后仍然出现此问题,我将卸载所有本地 eventmachine 版本并查看以下链接:

  1. 事件机问题 #411
  2. 问题 #217

希望这可以帮助!

于 2013-06-10T14:41:01.710 回答