Eventmachine gem install fail

对着背影说爱祢 提交于 2019-11-27 07:36:01
Fernando Vieira

I could install it, doing this steps:

1) tried a normal install:

gem install eventmachine

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

2) edited the file:

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

and commented the line 97

//typedef int pid_t;

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

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

c:\Ruby200-x64\lib\ruby\gems\2.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).

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:

gem install eventmachine-1.0.3.gem --local

And it installed successfully!

Kai

This worked for me:

brew link openssl --force 

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

ERROR: Error loading gemspec. Aborting.

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..

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.

Cheers!

Try

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

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

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

Before that I uninstalled eventmachine.

I had the same problem in linux.

I solved it by upgrading ruby to ruby-2.2.1.

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

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/

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.gemspec from a git checkout of the eventmachine repo.

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.

Rui Liu

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

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.

(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.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!