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

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

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

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

Ruby

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

Q&A

解決済

2回答

2343閲覧

bundle installでハマっております(汗)

Otoro

総合スコア36

Ruby on Rails 5

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

Ruby

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

0グッド

1クリップ

投稿2019/05/10 08:34

編集2019/05/10 12:32

Ruby on Rails の開発環境を構築中

開発環境:

macOS Mojave $ ruby -v ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin18] $ rbenv version 2.6.1 (set by /Users/username/.rbenv/version)

以下のコマンドを実行すると、、、

$ bundle install --path=vendor/bundle

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. になります(汗)

Fetching gem metadata from https://rubygems.org/............. Fetching gem metadata from https://rubygems.org/. Resolving dependencies... Using rake 12.3.2 Using concurrent-ruby 1.1.5 Using i18n 1.6.0 Using minitest 5.11.3 Using thread_safe 0.3.6 Using tzinfo 1.2.5 Using activesupport 5.2.3 Using builder 3.2.3 Using erubi 1.8.0 Using mini_portile2 2.4.0 Fetching nokogiri 1.10.3 Installing nokogiri 1.10.3 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /Users/username/Develop/Ruby/myapp/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.3/ext/nokogiri /Users/username/.rbenv/versions/2.6.1/bin/ruby -I /Users/username/.rbenv/versions/2.6.1/lib/ruby/2.6.0 -r ./siteconf20190510-40753-10jfnoy.rb extconf.rb checking if the C compiler accepts -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2... *** 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=/Users/username/.rbenv/versions/2.6.1/bin/$(RUBY_BASE_NAME) --help --clean /Users/username/.rbenv/versions/2.6.1/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /Users/username/.rbenv/versions/2.6.1/lib/ruby/2.6.0/mkmf.rb:585:in `block in try_compile' from /Users/username/.rbenv/versions/2.6.1/lib/ruby/2.6.0/mkmf.rb:532:in `with_werror' from /Users/username/.rbenv/versions/2.6.1/lib/ruby/2.6.0/mkmf.rb:585:in `try_compile' from extconf.rb:138:in `nokogiri_try_compile' from extconf.rb:162:in `block in add_cflags' from /Users/digi-angler/.rbenv/versions/2.6.1/lib/ruby/2.6.0/mkmf.rb:643:in `with_cflags' from extconf.rb:161:in `add_cflags' from extconf.rb:416:in `<main>' To see why this extension failed to compile, please check the mkmf.log which can be found here: /Users/username/Develop/Ruby/myapp/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/nokogiri-1.10.3/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /Users/username/Develop/Ruby/myapp/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.3 for inspection. Results logged to /Users/username/Develop/Ruby/myapp/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/nokogiri-1.10.3/gem_make.out An error occurred while installing nokogiri (1.10.3), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.10.3' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: rails was resolved to 5.2.3, which depends on actioncable was resolved to 5.2.3, which depends on actionpack was resolved to 5.2.3, which depends on actionview was resolved to 5.2.3, which depends on rails-dom-testing was resolved to 2.0.3, which depends on nokogiri

mkmf.log

"clang -o conftest -I/Users/username/.rbenv/versions/2.6.1/include/ruby-2.6.0/x86_64-darwin18 -I/Users/username/.rbenv/versions/2.6.1/include/ruby-2.6.0/ruby/backward -I/Users/username/.rbenv/versions/2.6.1/include/ruby-2.6.0 -I. -I/Users/username/.rbenv/versions/2.6.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -Wno-error=shorten-64-to-32 -pipe -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2 conftest.c -L. -L/Users/username/.rbenv/versions/2.6.1/lib -L. -L/Users/digi-angler/.rbenv/versions/2.6.1/lib -fstack-protector-strong -L/usr/local/lib -lruby.2.6-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc " In file included from conftest.c:1: In file included from /Users/username/.rbenv/versions/2.6.1/include/ruby-2.6.0/ruby.h:33: In file included from /Users/username/.rbenv/versions/2.6.1/include/ruby-2.6.0/ruby/ruby.h:29: /Users/username/.rbenv/versions/2.6.1/include/ruby-2.6.0/ruby/defines.h:123:10: fatal error: 'stdio.h' file not found #include <stdio.h> ^~~~~~~~~ 1 error generated. checked program was: /* begin */ 1: #include "ruby.h" 2: 3: int main(int argc, char **argv) 4: { 5: return 0; 6: } /* end */

原因は何?

しばらくググって調べましたが、ネット上にある記事が古かったり、バージョンが違ったり、
やっていること(解決方法)が違ったり・・・

nokogiriがコンパイルに失敗して、
インストールも失敗しているんですかね・・・

ライブラリ(libxml2)が不足?しているんですかね?

解決方法をご教授願います。

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

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

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

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

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

guest

回答2

0

/Users/username/.rbenv/versions/2.6.1/include/ruby-2.6.0/ruby/defines.h:123:10: fatal error: 'stdio.h' file not found #include <stdio.h> ^~~~~~~~~ 1 error generated.

https://github.com/sparklemotion/nokogiri/issues/1801

Command Line Tools for Xcode のインストールはお済みでしょうか。

投稿2019/05/10 08:46

kazto

総合スコア7196

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

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

Otoro

2019/05/10 12:10

Command Line Tools for Xcode をOSXにインストールしましたが、同じでした。 「Command_Line_Tools_macOS_10.14_for_Xcode_10.2.1」をインストールしました。
guest

0

自己解決

調べた結果、これで解決!

1.
open /Library/Developer/CommandLineTools/Packages/

2.
その後、「macOS_SDK_headers_for_macOS_10.14.pkg」をインストール。

3.
その後、 bundle install を実行し、無事完了。

投稿2019/05/12 07:30

Otoro

総合スコア36

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問