質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Q&A

解決済

1回答

8711閲覧

eventmachineのインストールについて

gorogo

総合スコア13

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

0グッド

0クリップ

投稿2018/10/09 03:15

前提・実現したいこと

rubyを勉強し始めたばかりのもです。
gemを使用しようとすると以下のエラーが出現します。

発生している問題・エラーメッセージ

Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby' Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby' C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- 2.4/rubyeventmachine (LoadError) from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.7-x64-mingw32/lib/rubyeventmachine.rb:2:in `<top (required)>' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `require' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:39:in `require' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.7-x64-mingw32/lib/eventmachine.rb:8:in `<top (required)>' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `require' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:39:in `require' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/faye-websocket-0.10.7/lib/faye/websocket.rb:10:in `<top (required)>' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/binance-1.2.0/lib/binance/client/websocket.rb:1:in `<top (required)>' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/binance-1.2.0/lib/binance.rb:3:in `<top (required)>' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `require' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:133:in `rescue in require' from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:39:in `require' from tes.rb:4:in `<main>'

試したこと

eventmachineが上手く作動していないのかと思い以下を参考にしました。
https://github.com/eventmachine/eventmachine/issues/806
gem install eventmachine --platform rubyを実行しインストーしようとしましたが今度は以下のエラーにより上手くインストールできませんでした。

Temporarily enhancing PATH for MSYS/MINGW... Building native extensions. This could take a while... ERROR: Error installing eventmachine: ERROR: Failed to build gem native extension. current directory: C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.7/ext C:/Ruby24-x64/bin/ruby.exe -r ./siteconf20181009-7756-1rrz7vj.rb extconf.rb checking for -lcrypto... no checking for -lssleay32... no checking for -lcrypto... no checking for -lssleay32... no checking for -lcrypto... no checking for -lssleay32... no checking for -lcrypto... no checking for -lssleay32... no checking for rb_trap_immediate in ruby.h,rubysig.h... no checking for rb_thread_blocking_region()... no checking for rb_thread_call_without_gvl() in ruby/thread.h... no checking for rb_thread_fd_select()... no checking for rb_fdset_t in ruby/intern.h... yes checking for rb_wait_for_single_fd()... no checking for rb_enable_interrupt()... no checking for rb_time_new()... no 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 pipe2() in unistd.h... no checking for accept4() in sys/socket.h... no checking for SOCK_CLOEXEC in sys/socket.h... no checking for windows.h... yes checking for winsock.h... yes checking for -lkernel32... no could not find library: kernel32 *** 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:/Ruby24-x64/bin/$(RUBY_BASE_NAME) --with-ssl-dir --without-ssl-dir --with-ssl-include --without-ssl-include=${ssl-dir}/include --with-ssl-lib --without-ssl-lib=${ssl-dir}/lib --with-openssl-config --without-openssl-config --with-pkg-config --without-pkg-config --with-cryptolib --without-cryptolib --with-ssleay32lib --without-ssleay32lib --with-ssl-dir --without-ssl-dir --with-ssl-include --without-ssl-include=${ssl-dir}/include --with-ssl-lib --without-ssl-lib=${ssl-dir}/lib --with-cryptolib --without-cryptolib --with-ssleay32lib --without-ssleay32lib --with-ssl-dir --without-ssl-dir --with-ssl-include --without-ssl-include=${ssl-dir}/include --with-ssl-lib --without-ssl-lib=${ssl-dir}/lib --with-cryptolib --without-cryptolib --with-ssleay32lib --without-ssleay32lib --with-ssl-dir --without-ssl-dir --with-ssl-include --without-ssl-include=${ssl-dir}/include --with-ssl-lib --without-ssl-lib=${ssl-dir}/lib --with-cryptolib --without-cryptolib --with-ssleay32lib --without-ssleay32lib --with-kernel32lib --without-kernel32lib To see why this extension failed to compile, please check the mkmf.log which can be found here: C:/Ruby24-x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/eventmachine-1.2.7/mkmf.log extconf failed, exit code 1 Gem files will remain installed in C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.7 for inspection. Results logged to C:/Ruby24-x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/eventmachine-1.2.7/gem_make.out

初心者であまり知識が無いのでこれ以上進めずにいます。
なにがいけないのかアドバイス頂けるとありがたいです。
足りない情報があれば教えて頂ければ追加します。
よろしくお願いします。

補足情報(FW/ツールのバージョンなど)

ridk versionの結果は以下です。

ruby: path: C:/Ruby24-x64 version: 2.4.4 platform: x64-mingw32 ruby_installer: package_version: 2.4.4-2 git_commit: 513abb8 msys2: path: C:\Ruby24-x64\msys64 cc: x86_64-w64-mingw32-gcc (Rev1, Built by MSYS2 project) 8.2.0 sh: GNU bash, バージョン 4.4.19(3)-release (x86_64-pc-msys) os: Microsoft Windows [Version 6.1.7601]

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

MSYS2が破損している可能性があります。
コマンドプロンプト等から

ridk install 1 2 3

を実行した後に

gem uninstall eventmachine gem install eventmachine --platform ruby -- --use-system-libraries

をお試しください

投稿2018/10/09 12:00

asm

総合スコア15147

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

gorogo

2018/10/10 02:53 編集

回答ありがとうございます。 msys2をインストール後、gem uninstall eventmachineを実行すると以下のエラーが表示されアンインストールできませんでした。 You have requested to uninstall the gem: eventmachine-1.2.7-x64-mingw32 faye-websocket-0.10.7 depends on eventmachine (>= 0.12.0) websocket-driver-0.7.0 depends on eventmachine (>= 0, development) websocket-driver-0.6.5 depends on eventmachine (>= 0, development) If you remove this gem, these dependencies will not be met. Continue with Uninstall? [yN] ERROR: While executing gem ... (Gem::DependencyRemovalException) Uninstallation aborted due to dependent gem(s)
asm

2018/10/10 03:03

んじゃ、gem uninstall eventmachine -I 依存関係無視して単体のみアンインストールします。
gorogo

2018/10/10 03:57

アンインストールは出来ましたが今度はインストールを実行すると以下が表示されます。 Temporarily enhancing PATH for MSYS/MINGW... Building native extensions with: '--use-system-libraries' This could take a while... ERROR: Error installing eventmachine: ERROR: Failed to build gem native extension. current directory: C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.7/ext C:/Ruby24-x64/bin/ruby.exe -r ./siteconf20181010-6912-1jxkopp.rb extconf.rb --use-system-libraries checking for -lcrypto... no checking for -lssleay32... no checking for -lcrypto... no checking for -lssleay32... no checking for -lcrypto... no checking for -lssleay32... no checking for -lcrypto... no checking for -lssleay32... no checking for rb_trap_immediate in ruby.h,rubysig.h... no checking for rb_thread_blocking_region()... no checking for rb_thread_call_without_gvl() in ruby/thread.h... no checking for rb_thread_fd_select()... no checking for rb_fdset_t in ruby/intern.h... yes checking for rb_wait_for_single_fd()... no checking for rb_enable_interrupt()... no checking for rb_time_new()... no 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 pipe2() in unistd.h... no checking for accept4() in sys/socket.h... no checking for SOCK_CLOEXEC in sys/socket.h... no checking for windows.h... yes checking for winsock.h... yes checking for -lkernel32... no could not find library: kernel32 *** 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:/Ruby24-x64/bin/$(RUBY_BASE_NAME) --with-ssl-dir --without-ssl-dir --with-ssl-include --without-ssl-include=${ssl-dir}/include --with-ssl-lib --without-ssl-lib=${ssl-dir}/lib --with-openssl-config --without-openssl-config --with-pkg-config --without-pkg-config --with-cryptolib --without-cryptolib --with-ssleay32lib --without-ssleay32lib --with-ssl-dir --without-ssl-dir --with-ssl-include --without-ssl-include=${ssl-dir}/include --with-ssl-lib --without-ssl-lib=${ssl-dir}/lib --with-cryptolib --without-cryptolib --with-ssleay32lib --without-ssleay32lib --with-ssl-dir --without-ssl-dir --with-ssl-include --without-ssl-include=${ssl-dir}/include --with-ssl-lib --without-ssl-lib=${ssl-dir}/lib --with-cryptolib --without-cryptolib --with-ssleay32lib --without-ssleay32lib --with-ssl-dir --without-ssl-dir --with-ssl-include --without-ssl-include=${ssl-dir}/include --with-ssl-lib --without-ssl-lib=${ssl-dir}/lib --with-cryptolib --without-cryptolib --with-ssleay32lib --without-ssleay32lib --with-kernel32lib --without-kernel32lib To see why this extension failed to compile, please check the mkmf.log which can be found here: C:/Ruby24-x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/eventmachine-1.2.7/mkmf.log extconf failed, exit code 1 Gem files will remain installed in C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/eventmachine-1.2.7 for inspection. Results logged to C:/Ruby24-x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/eventmachine-1.2.7/gem_make.out 度々すみません。
asm

2018/10/10 08:59

うーん 不思議ですね ridk exec pacman -S mingw-w64-x86_64-crt-git あたりで改善するかも知れませんししないかもしれません
gorogo

2018/10/10 09:53

改善しませんでした。 ruby2.3であれば問題なく動くのですが・・・
asm

2018/10/10 10:24

あとは、環境変数の問題かなーとは思いますが 確かめるためには、このスペースでは狭すぎますね・・・ カンだと 環境変数LIBが設定されているとかPATHにmakeなどのmingw-gccが設定されているとか… このへんがあやしいです
gorogo

2018/10/10 11:45

一応PATHを確認しましたが、.libなどの怪しいと思うものが見当たりませんが、私の知識が足りないため見逃している可能性が大きいです。 どこを確認すればいいのでしょうか? 面倒だと思いますが教えて頂けるとありがたいです。
asm

2018/10/10 16:30

C:/Ruby24-x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/eventmachine1.2.7/mkmf.log の checking for -lkernel32... no 直後にコマンドライン・ソース・エラーメッセージが書き込まれているはずです(多分)
gorogo

2018/10/10 23:00

これでしょうか? checking for -lkernel32... -------------------- no"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby24-x64/include/ruby-2.4.0/x64-mingw32 -IC:/Ruby24-x64/include/ruby-2.4.0/ruby/backward -IC:/Ruby24-x64/include/ruby-2.4.0 -I. -I/usr/local/opt/openssl/include -I/opt/local/include -I/usr/local/include -D_FORTIFY_SOURCE=2 -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET 私が見ても何が書いているのかよく分かりませんが・・・
asm

2018/10/10 23:15

正直、読み取れないと解決は難しいですよ ちなみに、尻切れになっていますが -Lc:/Ruby24-x64/msys64/mingw64/lib は書かれていましたか?
gorogo

2018/10/10 23:59

難しいですか・・・。 失礼しました。以下全文です。 checking for -lkernel32... -------------------- no "x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby24-x64/include/ruby-2.4.0/x64-mingw32 -IC:/Ruby24-x64/include/ruby-2.4.0/ruby/backward -IC:/Ruby24-x64/include/ruby-2.4.0 -I. -I/usr/local/opt/openssl/include -I/opt/local/include -I/usr/local/include -D_FORTIFY_SOURCE=2 -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -march=x86-64 -mtune=generic -O2 -pipe conftest.c -L. -LC:/Ruby24-x64/lib -L/usr/local/opt/openssl/lib -L/opt/local/lib -L/usr/local/lib -L. -pipe -lx64-msvcrt-ruby240 -lkernel32 -lgmp -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi " This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. Cannot create temporary file in C:\Users???c?G??\AppData\Local\Temp\: Invalid argument checked program was: /* begin */ 1: #include "ruby.h" 2: 3: #include <winsock2.h> 4: #include <windows.h> 5: 6: /*top*/ 7: extern int t(void); 8: int main(int argc, char **argv) 9: { 10: if (argc > 1000000) { 11: printf("%p", &t); 12: } 13: 14: return 0; 15: } 16: 17: int t(void) { ; return 0; } /* end */ -------------------- -Lc:/Ruby24-x64/msys64/mingw64/libはないと思います。
asm

2018/10/11 00:48

ちょっとばっかし予想外の原因でした This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. Cannot create temporary file in C:\Users???c?G??\AppData\Local\Temp\: Invalid argument なので、環境変数TEMPもしくはTMPが壊れているもしくは文字コードの関係でgccが扱えない のが問題の一つであるようです。
gorogo

2018/10/11 01:59 編集

そうなんですね。 ということはある程度知識が無いと問題の解決は難しいのでしょうか? それとも一時ファイルの保存先を作ればいいのでしょうか。
asm

2018/10/11 03:46

保存先を作ってやれば改善するかもしれません。
gorogo

2018/10/12 00:08

保存先を作ってもやはり改善しません。 これはPC側の問題ということでしょうか?
asm

2018/10/12 02:40 編集

新規インストール状態のwin7にrubyinstaller2 2.4.4-2をインストール後に gem install eventmachine --platform ruby -- --use-system-libraries を試してみましたが再現しません。 あなたの環境固有の問題と言わざるをえません。
gorogo

2018/10/12 09:05 編集

わざわざ試していただいてありがとうございます。 試しに友人のPCを借りてやってみたら上手くいったので私のPCの問題と思います。 ruby2.3では正常に作動しているのでとりあえずそちらを使おうと思います。 丁寧に教えて頂き本当にありがとうございました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問