Eventmachine gem のインストールに失敗する
概要
イベントマシンをインストールできません
これはかなり多くの質問を受けていることは承知していますが、これまでのところ私を助けてくれる解決策は見つかりませんでした。そこで、最後の手段としてここに投稿しました。
Ruby 2.0.0p195 (x64) (適切な Devkit を含む Windows 用 Ruby インストーラーを通じてインストール) を使用して Windows 8 x64 を使用しています。
したがって、エラーは次のとおりです
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
gem「eventmachine」、「~> 1.0.3」またはgem「eventmachine」、「~> 1.0.0.beta.4.1」をgemfileに入れて、gemfile.lockからeventmachineを削除/変更しようとしたこと 新しいテキストアプリを作成し、そこにEventmachineをインストールします(失敗)
私が思っていることは、eventmachine の依存関係 (Rubygems で見つけることができます) を追跡したところ、bluecloth もインストールできないことがわかり (さらに大きなログエラーが表示されます)、tidy-ext (bluecloth の依存関係) もインストールできないことがわかりました。何らかの関連性があり、薄く取り付けることもできません
何か情報があれば聞いてください
皆さん、よろしくお願いします!!
解決策
次の手順を実行すると、インストールできました。
- 通常のインストールを試みました:
gem install eventmachine
gem のバージョン 1.0.3 をフェッチしましたが、変数宣言の競合により make に失敗しました。
- ファイルを編集しました:
c:\Ruby200-x64\lib\ruby\gems\2.0.0\gems\eventmachine-1.0.3\ext\project.h
そして97行目をコメントしました
//typedef int pid_t;
より堅牢な修正については、ここで解決策をチェックしてください https://github.com/eventmachine/eventmachine/pull/450/files
- 次に、コマンドプロンプトを開いて gem フォルダーに移動しました。
c:\Ruby200-x64\lib\ruby\gems\2.0.0\gems\eventmachine-1.0.3
そして実行します:
gem build eventmachine.gemspec
これを機能させるには、PATH 内の git.exe の場所 (C:~1 など) を指定して git をインストールする必要があります。
4)フォルダー上にeventmachine.gemファイルが生成されました…そこで、ファイルをc: mpフォルダーにコピーし、そのフォルダーに移動し、そこから次のように入力しました。
gem install eventmachine-1.0.3.gem --local
そして無事にインストールされました!