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

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

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

SQLiteはリレーショナルデータベース管理システムの1つで、サーバーではなくライブラリとして使用されている。

RubyGems

RubyGemsはRubyによるプログラミングのためのパッケージマネジメントツールです。ユーザはこれを使用することで、Rubyライブラリのダウンロードやアップデートや、依存関係の自動解決が可能になります。

Ruby on Rails

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

Ruby on Rails 4

Ruby on Rails4はRubyによって書かれたオープンソースのウェブフレームワークです。 Ruby on Railsは「設定より規約」の原則に従っており、効率的に作業を行うために再開発を行う必要をなくしてくれます。

Q&A

解決済

1回答

6286閲覧

Ruby on railsでbundle installできまません

tomato0

総合スコア13

SQLite

SQLiteはリレーショナルデータベース管理システムの1つで、サーバーではなくライブラリとして使用されている。

RubyGems

RubyGemsはRubyによるプログラミングのためのパッケージマネジメントツールです。ユーザはこれを使用することで、Rubyライブラリのダウンロードやアップデートや、依存関係の自動解決が可能になります。

Ruby on Rails

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

Ruby on Rails 4

Ruby on Rails4はRubyによって書かれたオープンソースのウェブフレームワークです。 Ruby on Railsは「設定より規約」の原則に従っており、効率的に作業を行うために再開発を行う必要をなくしてくれます。

0グッド

0クリップ

投稿2016/11/26 17:39

編集2016/11/26 18:52

与えられたGemfileからbundle installをしたところ以下のエラーメッセージ1が発生しました。
エラーメッセージ1からgem install sqlite3 -v '1.3.8'するよう書いてあるためgem install sqlite3 -v '1.3.8'を行ったところエラーメッセージ2になりました。
知識不足で申し訳ないのですが、解決策をお教えいただければ幸いです。

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

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /Users/Takahiro/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.8/ext/sqlite3 /Users/Takahiro/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20161127-37682-3mbd8o.rb extconf.rb checking for sqlite3.h... yes checking for sqlite3_libversion_number() in -lsqlite3... yes checking for rb_proc_arity()... yes checking for sqlite3_initialize()... yes checking for sqlite3_backup_init()... yes checking for sqlite3_column_database_name()... no checking for sqlite3_enable_load_extension()... no checking for sqlite3_load_extension()... no checking for sqlite3_open_v2()... yes checking for sqlite3_prepare_v2()... yes checking for sqlite3_int64 in sqlite3.h... yes checking for sqlite3_uint64 in sqlite3.h... yes creating Makefile To see why this extension failed to compile, please check the mkmf.log which can be found here: /Users/Takahiro/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/sqlite3-1.3.8/mkmf.log current directory: /Users/Takahiro/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.8/ext/sqlite3 make "DESTDIR=" clean current directory: /Users/Takahiro/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.8/ext/sqlite3 make "DESTDIR=" compiling backup.c compiling database.c compiling exception.c compiling sqlite3.c compiling statement.c statement.c:261:11: warning: implicit declaration of function 'RBIGNUM' is invalid in C99 [-Wimplicit-function-declaration] if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) { ^ ./sqlite3_ruby.h:16:24: note: expanded from macro 'RBIGNUM_LEN' #define RBIGNUM_LEN(x) RBIGNUM(x)->len ^ statement.c:261:11: error: member reference type 'int' is not a pointer if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) { ^~~~~~~~~~~~~~~~~~ ./sqlite3_ruby.h:16:36: note: expanded from macro 'RBIGNUM_LEN' #define RBIGNUM_LEN(x) RBIGNUM(x)->len ~~~~~~~~~~ ^ statement.c:261:32: error: use of undeclared identifier 'SIZEOF_BDIGITS' if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) { ^ 1 warning and 2 errors generated. make: *** [statement.o] Error 1 make failed, exit code 2 Gem files will remain installed in /Users/Takahiro/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.8 for inspection. Results logged to /Users/Takahiro/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/sqlite3-1.3.8/gem_make.out An error occurred while installing sqlite3 (1.3.8), and Bundler cannot continue. Make sure that `gem install sqlite3 -v '1.3.8'` succeeds before bundling.

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

Building native extensions. This could take a while... ERROR: Error installing sqlite3: ERROR: Failed to build gem native extension. current directory: /Users/Takahiro/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.8/ext/sqlite3 /Users/Takahiro/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20161127-41731-1pc2nfg.rb extconf.rb checking for sqlite3.h... yes checking for sqlite3_libversion_number() in -lsqlite3... yes checking for rb_proc_arity()... yes checking for sqlite3_initialize()... yes checking for sqlite3_backup_init()... yes checking for sqlite3_column_database_name()... no checking for sqlite3_enable_load_extension()... no checking for sqlite3_load_extension()... no checking for sqlite3_open_v2()... yes checking for sqlite3_prepare_v2()... yes checking for sqlite3_int64 in sqlite3.h... yes checking for sqlite3_uint64 in sqlite3.h... yes creating Makefile To see why this extension failed to compile, please check the mkmf.log which can be found here: /Users/Takahiro/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/sqlite3-1.3.8/mkmf.log current directory: /Users/Takahiro/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.8/ext/sqlite3 make "DESTDIR=" clean current directory: /Users/Takahiro/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.8/ext/sqlite3 make "DESTDIR=" compiling backup.c compiling database.c compiling exception.c compiling sqlite3.c compiling statement.c statement.c:261:11: warning: implicit declaration of function 'RBIGNUM' is invalid in C99 [-Wimplicit-function-declaration] if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) { ^ ./sqlite3_ruby.h:16:24: note: expanded from macro 'RBIGNUM_LEN' #define RBIGNUM_LEN(x) RBIGNUM(x)->len ^ statement.c:261:11: error: member reference type 'int' is not a pointer if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) { ^~~~~~~~~~~~~~~~~~ ./sqlite3_ruby.h:16:36: note: expanded from macro 'RBIGNUM_LEN' #define RBIGNUM_LEN(x) RBIGNUM(x)->len ~~~~~~~~~~ ^ statement.c:261:32: error: use of undeclared identifier 'SIZEOF_BDIGITS' if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) { ^ 1 warning and 2 errors generated. make: *** [statement.o] Error 1 make failed, exit code 2 Gem files will remain installed in /Users/Takahiro/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.8 for inspection. Results logged to /Users/Takahiro/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/sqlite3-1.3.8/gem_make.out

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

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

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

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

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

guest

回答1

0

ベストアンサー

いくつか同じ現象が報告されています。

https://github.com/sparklemotion/sqlite3-ruby/issues/181
https://github.com/sparklemotion/sqlite3-ruby/issues/157
https://gist.github.com/zzak/695d1e25ec13d62ca671#gistcomment-1364746

一つは自分でコンパイルしたときにライブラリ等のパスがおかしくなっていた?(自利解決したようで詳細は不明)という物です。rbenvでインストールしているのであればこの問題はたぶん発生しません。

もう一つの問題が重要で、sqlite3 1.3.8はRuby 2.2.0以上では動かないため、1.3.10以上に上げる必要があるという物です。パスから推測するに、Macでrbenvを使って2.3.1を入れているようですが、この2.3.1にsqlite3 1.3.8を入れることは(自分でパッチを当てるとかしない限り)不可能です。

取れる手段は二つです。

  1. sqilet3を1.3.10以上にする(最新は1.3.12です)。

単純にbundle updateとすることで、最新になる場合があります。もし、これでうまくいかない場合は、"Gemfile"のsqlite3の所でバージョンが1.3.8固定に設定されている所を変更し、bundle updateを実施してください。もし、sqlite3が書いてなければ、gem sqlite3, '~> 1.3.10'と追加して、bundle updateしてください。もしかしたら、他のライブラリとの依存関係でバージョンコンフリクトが発生するかも知れません。その場合は、sqlite3を必要としているライブラリのバージョンもsqilet3 1.3.10以降を使うように上げてください。

  1. Ruby 2.1.xを使う

rbenvで2.1.x系の最新を入れて、それを使用してください。(2.1.x系のサポートは来年4月頃には終了しますので、ご注意ください)

投稿2016/11/26 21:26

編集2016/11/26 21:27
raccy

総合スコア21735

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

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

tomato0

2016/11/27 04:10

Gemfileのsqlite3を1.3.8から1.3.10に変更後bundle installに変えたところ無事解決できました。 ありがとうございました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問