ruby Eventmachine gem 安装失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17361958/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-06 06:02:42  来源:igfitidea点击:

Eventmachine gem install fail

rubyeventmachine

提问by Vasspilka

I am not able to install eventmachine

我无法安装 eventmachine

Ok I know this has been asked quite a lot, but no solutions I found has helped me so far.So I posted here as a last resort.

好的,我知道这已经被问了很多,但到目前为止我发现没有任何解决方案对我有帮助。所以我在这里发布作为最后的手段。

I usewindows 8 x64using ruby 2.0.0p195 (x64)(installed throught Ruby Installer for Windows with the apropriate Devkit)

我使用windows 8 x64using ruby 2.0.0p195 (x64)(通过Ruby Installer for Windows 安装,带有适当的 Devkit)

So the Erroris

所以错误

    Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
C:/Ruby200-x64/bin/ruby.exe extconf.rb
checking for main() in -lssl... no
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... no
checking for rb_wait_for_single_fd()... yes
checking for rb_enable_interrupt()... no
checking for rb_time_new()... yes
checking for windows.h... yes
checking for winsock.h... yes
checking for main() in -lkernel32... yes
checking for main() in -lrpcrt4... yes
checking for main() in -lgdi32... yes
creating Makefile

make
generating rubyeventmachine-x64-mingw32.def
compiling binder.cpp
In file included from c:\users\btdy\downloads\devkit\mingw\bin\../lib/gcc/x86_64
-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/include/process.h:12:0,
             from c:/Ruby200-x64/include/ruby-2.0.0/ruby/win32.h:60,
             from c:/Ruby200-x64/include/ruby-2.0.0/ruby/defines.h:153,
             from c:/Ruby200-x64/include/ruby-2.0.0/ruby/ruby.h:70,
             from c:/Ruby200-x64/include/ruby-2.0.0/ruby.h:33,
             from em.h:24,
             from project.h:150,
             from binder.cpp:20:
c:\users\btdy\downloads\devkit\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../
../../../x86_64-w64-mingw32/include/sys/types.h:68:16: error: conflicting declar
ation 'typedef _pid_t pid_t'
In file included from binder.cpp:20:0:
project.h:97:13: error: 'pid_t' has a previous declaration as 'typedef int pid_t
'
In file included from project.h:151:0,
             from binder.cpp:20:
ed.h: In member function 'void EventableDescriptor::SetSocketInvalid()':
ed.h:43:40: warning: overflow in implicit constant conversion [-Woverflow]
make: *** [binder.o] Error 1      

Things I have triedputting gem "eventmachine", "~> 1.0.3"or gem "eventmachine", "~> 1.0.0.beta.4.1"in my gemfile and removed/modify eventmachine from gemfile.lockmaking a new testapp and instaling Eventmachine there (fail)

我尝试gem "eventmachine", "~> 1.0.3"gem "eventmachine", "~> 1.0.0.beta.4.1"放入我的 gemfile 并删除/修改 eventmachine 以gemfile.lock制作新的 testapp 并在那里安装 Eventmachine 的事情(失败)

Things I suspectI tracked down dependencies for eventmachine(can be found on Rubygems) and I see that I cannot install blueclothneither (shows even bigger log error) and neither can I install tidy-ext(bluecloth depencency) so I think it might have some relevance , also cannot install thin

我怀疑我跟踪了 eventmachine 的依赖项(可以在 Rubygems 上找到)的事情,我发现我既不能安装bluecloth(显示更大的日志错误)也不能安装tidy-ext(bluecloth depencency),所以我认为它可能有有些相关,也不能装瘦

For any info just ask

对于任何信息,只需询问

Thank you all in advance!!

谢谢大家!!

回答by Fernando Vieira

I could install it, doing this steps:

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

1) tried a normal install:

1)尝试正常安装:

gem install eventmachine

it fetched the version 1.0.3 of the gem, but failed in the make, because of a variable declaration conflit

它获取了 gem 的 1.0.3 版本,但在 make 中失败,因为变量声明冲突

2) edited the file:

2)编辑文件:

c:\Ruby200-x64\lib\ruby\gems.0.0\gems\eventmachine-1.0.3\ext\project.h

and commented the line 97

并评论了第 97 行

//typedef int pid_t;

for a more robust correction, checkout the solution here https://github.com/eventmachine/eventmachine/pull/450/files

如需更强大的修正,请在此处查看解决方案https://github.com/eventmachine/eventmachine/pull/450/files

3) then, i've opened command prompt, and went to the gem folder

3)然后,我打开命令提示符,然后转到 gem 文件夹

c:\Ruby200-x64\lib\ruby\gems.0.0\gems\eventmachine-1.0.3

and run:

并运行:

gem build eventmachine.gemspec

You need git installed with the git.exe location in the PATH for this to work (such as C:\Users\YourUsername\AppData\Local\GitHub\PORTAB~1\bin).

您需要使用 PATH 中的 git.exe 位置安装 git 才能使其工作(例如 C:\Users\YourUsername\AppData\Local\GitHub\PORTAB~1\bin)。

4) it generated a eventmachine.gem file on the folder... So I've copied a file to a c:\tmp folder, and went to that folder and from there, I've typed:

4)它在文件夹上生成了一个 eventmachine.gem 文件......所以我已经将一个文件复制到 ac:\tmp 文件夹,然后转到该文件夹​​,然后从那里输入:

gem install eventmachine-1.0.3.gem --local

And it installed successfully!

并且安装成功!

回答by Kai

This worked for me:

这对我有用:

brew link openssl --force 

回答by Chandru

I got an error as below

我收到如下错误



C:\Ruby200-x64\lib\ruby\gems\2.0.0\gems\eventmachine-1.0.3>gem build eventmachine.gemspec Invalid gemspec in [eventmachine.gemspec]: No such file or directory - git ls-files

C:\Ruby200-x64\lib\ruby\gems\2.0.0\gems\eventmachine-1.0.3>gem build eventmachine.gemspec Invalid gemspec in [eventmachine.gemspec]: 没有那个文件或目录 - git ls-files

ERROR: Error loading gemspec. Aborting.

错误:加载 gemspec 时出错。中止。

However, I kept the project.h opened in textpad and tried to do gem install eventmachine. At one point, textpad will ask a confirmation to reload project.h as the new file is fetched from gem install command.. just give reload and comment the line //typedef int pid_t;.. Then the compilation went through..

但是,我一直在 textpad 中打开 project.h 并尝试执行 gem install eventmachine。在某一时刻,textpad 会要求确认重新加载 project.h,因为新文件是从 gem install 命令获取的。只需重新加载并注释 //typedef int pid_t; 行。然后编译就完成了。

basically, it takes a while to start the compilation after fetching the gem project files. Just use that time to comment htis line.. It worked for me.. may not work for everyone.

基本上,获取gem项目文件后开始编译需要一段时间。只需利用这段时间评论 htis 行.. 它对我有用.. 可能并不适合所有人。

Cheers!

干杯!

回答by Rajat Bansal

Try

尝试

gem install eventmachine -- --with-cppflags=-I/usr/local/opt/openssl/include

回答by ?zbek

I had the same problem and successfully able to run it by adding below at the beginning of the Gemfile:

我遇到了同样的问题,并通过在以下内容的开头添加以下内容来成功运行它Gemfile

gem 'eventmachine', :git => 'git://github.com/eventmachine/eventmachine.git', :branch => 'master'

Before that I uninstalled eventmachine.

在此之前,我卸载了eventmachine.

回答by Rohan Daxini

I faced similar issues today for eventmachine gem (for both version 1.0.3 & 1.0.4) while upgrading to Ruby 2.2.0. And I fixed it by installing latest "developer tools" for MAC OSX 10.10.1 Yosemite and XCode 6.1.1

我今天在升级到 Ruby 2.2.0 时遇到了类似的 eventmachine gem(版本 1.0.3 和 1.0.4)问题。我通过为 MAC OSX 10.10.1 Yosemite 和 XCode 6.1.1 安装最新的“开发人员工具”来修复它

Here is my detailed blog post for resolving this issue with eventmachine gem installation - https://blog.kiprosh.com/upgrading-to-ruby-2-2-0-issues-installing-gem-eventmachine/

这是我使用 eventmachine gem 安装解决此问题的详细博客文章 - https://blog.kiprosh.com/upgrading-to-ruby-2-2-0-issues-installing-gem-eventmachine/

回答by Neha Suwal

I had the same problem in linux.

我在 linux 中遇到了同样的问题。

I solved it by upgrading ruby to ruby-2.2.1.

我通过将 ruby​​ 升级到ruby-2.2.1.

回答by sparkym3

The above answer on how to compile did not work for me, as I would get the "cannot load such file" message. I resolved this problem by running the gem build eventmachine.gemspecfrom a git checkout of the eventmachine repo.

上面关于如何编译的答案对我不起作用,因为我会收到“无法加载此类文件”的消息。我通过gem build eventmachine.gemspec从 eventmachine 存储库的 git checkout运行 解决了这个问题。

https://github.com/eventmachine/eventmachine/tree/v1.0.3

https://github.com/eventmachine/eventmachine/tree/v1.0.3

You should be able to see that the size of the .gem file is much greater as it actually includes the proper code.

您应该能够看到 .gem 文件的大小要大得多,因为它实际上包含了正确的代码。

回答by Rui Liu

You can try this answer here: Rails - cannot run app: Unable to load the EventMachine C extension;

您可以在这里尝试这个答案: Rails - 无法运行应用程序:无法加载 EventMachine C 扩展;

The Accepted answer to this question works. But you'll have other problems as shown in the comments below.

这个问题的公认答案有效。但是您还会遇到其他问题,如下面的评论所示。

Follow the solution by suda in the link, you'll be fine.

按照链接中 suda 的解决方案进行操作,您会没事的。

(Actually, it's basically compiling and installing gem from the master github code repo. I was surprised they haven't pushed the issue fix into master yet, since they're aware of it.)

(实际上,它基本上是从 master github code repo 编译和安装 gem。我很惊讶他们还没有将问题修复推送到 master 中,因为他们知道这一点。)