@kinakomiso

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

Ruby on Railsのインストールができない。

解決したいこと

windowsを利用しています。
Railsのインストールができません。
rails5.2.5をインストールしたく、コマンドプロンプトでgem install rails -v 5.2.5を実行した結果、エラーが発生しました。

発生している問題・エラー

Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR:  Error installing rails:
        ERROR: Failed to build gem native extension.

    current directory: C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/racc-1.6.0/ext/racc/cparse
C:/Ruby26-x64/bin/ruby.exe -I C:/Ruby26-x64/lib/ruby/2.6.0 -r ./siteconf20211110-14788-uwrfdk.rb extconf.rb
checking for rb_block_call()... *** 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:/Ruby26-x64/bin/$(RUBY_BASE_NAME)
C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
        from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:552:in `try_link0'
        from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:570:in `try_link'
        from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:782:in `try_func'
        from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:1069:in `block in have_func'
        from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
        from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
        from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:331:in `open'
        from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
        from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:331:in `open'
        from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
        from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
        from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:1068:in `have_func'
        from extconf.rb:6:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  C:/Ruby26-x64/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/racc-1.6.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/racc-1.6.0 for inspection.
Results logged to C:/Ruby26-x64/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/racc-1.6.0/gem_make.out

自分で試したこと

調べてみましたが、分からず、質問いたしました。
よろしくお願いいたします。

0 likes

3Answer

Comments

  1. @kinakomiso

    Questioner

    ありがとうございます。
    中身を見たところ

    "x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby26-x64/include/ruby-2.6.0/x64-mingw32 -IC:/Ruby26-x64/include/ruby-2.6.0/ruby/backward -IC:/Ruby26-x64/include/ruby-2.6.0 -I. -D_FORTIFY_SOURCE=2 -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math conftest.c -L. -LC:/Ruby26-x64/lib -L. -pipe -s -lx64-msvcrt-ruby260 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
    checked program was:
    /* begin */
    1: #include "ruby.h"
    2:
    3: #include <winsock2.h>
    4: #include <windows.h>
    5: int main(int argc, char **argv)
    6: {
    7: return 0;
    8: }
    /* end */


    となっていました。
    何かおかしいところなどありましたら教えていただきたいです...。

「詳細はmkmf.logを確認してください」と言われているので、中身を見てみたらいかがでしょうか。

0Like

Comments

  1. @kinakomiso

    Questioner

    ありがとうございます。
    中身を見たところ

    "x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby26-x64/include/ruby-2.6.0/x64-mingw32 -IC:/Ruby26-x64/include/ruby-2.6.0/ruby/backward -IC:/Ruby26-x64/include/ruby-2.6.0 -I. -D_FORTIFY_SOURCE=2 -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math conftest.c -L. -LC:/Ruby26-x64/lib -L. -pipe -s -lx64-msvcrt-ruby260 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
    checked program was:
    /* begin */
    1: #include "ruby.h"
    2:
    3: #include <winsock2.h>
    4: #include <windows.h>
    5: int main(int argc, char **argv)
    6: {
    7: return 0;
    8: }
    /* end */


    となっていました。
    何かおかしいところなどありましたら教えていただきたいです...。

検索すれば似たようなエラーは出てきますよ。
rubyのインストール周りに問題があるような可能性が高そうです。一回全部アンインストールして

などからもう一度ちゃんと入れてみるとか?

0Like

Your answer might help someone💌