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

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

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

Unicornは、汎用のRackアプリケーションサーバ。RackとWebサーバーの機能を併せ持ちます。レスポンス処理や、Nginx単体がRackの機能をサポートしていない事から、一般的にはNginx+Unicorn+Railsの構成を取って用います。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

AWS(Amazon Web Services)

Amazon Web Services (AWS)は、仮想空間を機軸とした、クラスター状のコンピュータ・ネットワーク・データベース・ストーレッジ・サポートツールをAWSというインフラから提供する商用サービスです。

Q&A

解決済

1回答

1553閲覧

Windows10でrailsアプリをAWSにデプロイを試みるもunicornの設定ができず詰んでいる。

Ko-program

総合スコア11

unicorn

Unicornは、汎用のRackアプリケーションサーバ。RackとWebサーバーの機能を併せ持ちます。レスポンス処理や、Nginx単体がRackの機能をサポートしていない事から、一般的にはNginx+Unicorn+Railsの構成を取って用います。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

AWS(Amazon Web Services)

Amazon Web Services (AWS)は、仮想空間を機軸とした、クラスター状のコンピュータ・ネットワーク・データベース・ストーレッジ・サポートツールをAWSというインフラから提供する商用サービスです。

0グッド

0クリップ

投稿2021/08/19 09:22

前提・実現したいこと

ここに質問の内容を詳しく書いてください。
Windows10でrailsのアプリケーションを作ったのですが、以下を参考にAWSでデプロイを試みるもunicornに関するエラーが解決できず、完全に詰んでいる状況です。ちなみにエディターはVScodeです。
https://pikawaka.com/rails/ec2_deploy

以下のようなteratailの同じようなエラーは一通り調べたのですが、どれもmacが前提で全く参考になりませんでした。
https://teratail.com/questions/202302

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

group :production do gem 'unicorn' end とGemfileに入力し、bundle installしたものの To see why this extension failed to compile, please check the mkmf.log which can be found here: C:/Ruby27-x64/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/kgio-2.11.4/mkmf.log extconf failed, exit code 1 Gem files will remain installed in C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/kgio-2.11.4 for inspection. Results logged to C:/Ruby27-x64/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/kgio-2.11.4/gem_make.out An error occurred while installing kgio (2.11.4), and Bundler cannot continue. Make sure that `gem install kgio -v '2.11.4' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: unicorn was resolved to 6.0.0, which depends on kgio と出たので、上記の通り'gem install kgio -v '2.11.4' --source 'https://rubygems.org/'も試しましたが Temporarily enhancing PATH for MSYS/MINGW... Building native extensions. This could take a while... ERROR: Error installing kgio: ERROR: Failed to build gem native extension. current directory: C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/kgio-2.11.4/ext/kgio C:/Ruby27-x64/bin/ruby.exe -I C:/Ruby27-x64/lib/ruby/2.7.0 -r ./siteconf20210819-7196-9ka8l8.rb extconf.rb checking for CLOCK_MONOTONIC in time.h... yes checking for clockid_t in time.h... yes checking for clock_gettime() in -lrt... no checking for t_open() in -lnsl... no checking for socket() in -lsocket... no checking for poll() in poll.h... no checking for getaddrinfo() in sys/types.h,sys/socket.h,netdb.h... no getaddrinfo required *** 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:/Ruby27-x64/bin/$(RUBY_BASE_NAME) --with-rt-dir --without-rt-dir --with-rt-include --without-rt-include=${rt-dir}/include --with-rt-lib --without-rt-lib=${rt-dir}/lib --with-rtlib --without-rtlib --with-nsl-dir --without-nsl-dir --with-nsl-include --without-nsl-include=${nsl-dir}/include --with-nsl-lib --without-nsl-lib=${nsl-dir}/lib --with-nsllib --without-nsllib --with-socket-dir --without-socket-dir --with-socket-include --without-socket-include=${socket-dir}/include --with-socket-lib --without-socket-lib=${socket-dir}/lib --with-socketlib --without-socketlib To see why this extension failed to compile, please check the mkmf.log which can be found here: C:/Ruby27-x64/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/kgio-2.11.4/mkmf.log extconf failed, exit code 1 Gem files will remain installed in C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/kgio-2.11.4 for inspection. Results logged to C:/Ruby27-x64/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/kgio-2.11.4/gem_make.out と出ました。 あと少しでデプロイできそうなのに、もうこのエラーに1週間悩まされています。 どうか解決の糸口になるような知恵をいただきたく、質問させていただきます。

該当のソースコード

試したこと

上記で述べたもの以外であれば、
gem install kgio -v '2.11.4' --source 'https://rubygems.org/のコマンドの結果の

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

C:/Ruby27-x64/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/kgio-2.11.4/mkmf.log

extconf failed, exit code 1

の中にある

C:/Ruby27-x64/lib/ruby/gems/2.7.0/extensions/x64-mingw32/2.7.0/kgio-2.11.4/mkmf.log

こちらをエディターで見てみた結果

have_macro: checking for CLOCK_MONOTONIC in time.h... -------------------- yes

"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby27-x64/include/ruby-2.7.0/x64-mingw32 -IC:/Ruby27-x64/include/ruby-2.7.0/ruby/backward -IC:/Ruby27-x64/include/ruby-2.7.0 -I. -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DPOSIX_C_SOURCE=1-D_POSIX_C_SOURCE=200112L -O3 -fno-fast-math -fstack-protector-strong conftest.c -L. -LC:/Ruby27-x64/lib -L. -pipe -s -fstack-protector-strong -lx64-msvcrt-ruby270 -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 !!argv[argc];
8: }
/
end */

"x86_64-w64-mingw32-gcc -IC:/Ruby27-x64/include/ruby-2.7.0/x64-mingw32 -IC:/Ruby27-x64/include/ruby-2.7.0/ruby/backward -IC:/Ruby27-x64/include/ruby-2.7.0 -I. -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DPOSIX_C_SOURCE=1-D_POSIX_C_SOURCE=200112L -O3 -fno-fast-math -fstack-protector-strong -c conftest.c"
checked program was:
/* begin /
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: #include <time.h>
6: /top/
7: #ifndef CLOCK_MONOTONIC
8: # error
9: |:/ === CLOCK_MONOTONIC undefined === /:|
10: #endif
/
end */


これに似たような文字列があと6つ書かれていたのですが、なんのことだか全くわからないため一度スルーしたぐらいです。

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

ruby(2.7.2),

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

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

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

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

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

guest

回答1

0

ベストアンサー

RubyInstallerなどのWindows版のRubyを使うのをやめましょう。
ERROR: Failed to build gem native extension.というエラーが出た場合、
Windowsでは解決できない場合もあります。

Linux環境を用意してその上でRails開発を行うのが一般的な解決策となります。
主な方法としては2つあります。

  • (1) WSLでUbuntu環境を構築する
  • (2) vagrant + VirtualBoxで仮想マシンを作成してCentOSまたはUbuntu環境を構築する

自分もOSとしてはWindows10を使っていますが、Rails開発時には(2)の方法で仮想マシンを起動してその中でRailsの開発をしています。

投稿2021/08/19 09:35

mingos

総合スコア4032

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

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

Ko-program

2021/10/01 06:01

vagrant + VirtualBox の仮想環境でrailsのアプリを作ったのですが、それをどうすればAWSにデプロイできますか?AWSでのデプロイといえば、キーペアのpemファイルをダウンロードしてDownloadsフォルダに保管し、それを.sshフォルダに移すと思いますが、仮想環境内ではDownloadsフォルダ(この場合ディレクトリというのかも)が見当たりませんでした。これではどうやってAWSにログインすればいいかがわかりません。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.46%

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

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

質問する

関連した質問