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

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

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

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

Ruby on Rails

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

Q&A

解決済

2回答

15334閲覧

Ruby on Railsをcdから、rails s をした時にsqlite3_nativeがないため、エラー返します。また、sqlite3_nativeを入れても解決できません。

algorithm

総合スコア11

Ruby

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

Ruby on Rails

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

1グッド

4クリップ

投稿2016/08/19 23:39

編集2016/08/20 00:05

###前提・実現したいこと
rails sを実行したいです。現状、sqlite3_nativeで失敗します。

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

C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.11-x64-mingw32/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)``` また sqlite3_native(C:\Ruby23-x64\lib\ruby\gems\2.3.0\gems\sqlite3-1.3.11-x64-mingw32\lib\sqlite3\2.1 の sqlite3_native.so を拝借)を入れた場合は、 C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.11-x64-mingw32/lib/sqlite3.rb:6:in `require': 126: 指定されたモジュールが見つかりません。 - C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.11-x64-mingw32/lib/sqlite3/sqlite3_native.so (LoadError)

###該当のソースコード
c:\rails\myApp>rails s C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.11-x64-mingw32/lib/sqlite3.rb:6:inrequire': cannot load such file -- sqlite3/sqlite3_native (LoadError)
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.11-x64-mingw32/lib/sqlite3.rb:6:in rescue in <top (required)>' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.11-x64-mingw32/lib/sqlite3.rb:2:in <top (required)>'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in require' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in block (2 levels) in require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in each' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in block in require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in each' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:102:in require' from c:/rails/myApp/config/application.rb:7:in <top (required)>'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:78:in require' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:78:in block in server'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:75:in tap' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:75:in server'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:39:in run_command!' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.7.1/lib/rails/commands.rb:17:in <top (required)>'
from bin/rails:4:in require' from bin/rails:4:in <main>'

または

c:\rails\myApp>rails s
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.11-x64-mingw32/lib/sqlite3.rb:6:in require': 126: 指定されたモジュールが見つかりません。 - C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.11-x64-mingw32/lib/sqlite3/sqlite3_native.so (LoadError) from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.11-x64-mingw32/lib/sqlite3.rb:6:in rescue in <top (required)>'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.11-x64-mingw32/lib/sqlite3.rb:2:in <top (required)>' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in block (2 levels) in require' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in each'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in block in require' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in each'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in require' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:102:in require'
from c:/rails/myApp/config/application.rb:7:in <top (required)>' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:78:in require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:78:in block in server' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:75:in tap'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:75:in server' from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.7.1/lib/rails/commands/commands_tasks.rb:39:in run_command!'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-4.2.7.1/lib/rails/commands.rb:17:in <top (required)>' from bin/rails:4:in require'
from bin/rails:4:in `<main>'

###試したこと
C:\Ruby23-x64\bin に http://www.sqlite.org/download.html からダウンロードしたsqlite3.dll と sqlite3.def を入れた。
C:\Ruby23-x64\bin に sqlite3.exeを入れた。
c:\rails\myApp>sqlite3 -version
3.14.1 2016-08-11 18:53:32 a12d8059770df4bca59e321c266410344242bf7b
でsqlite3 は認識している。
[https://teratail.com/questions/44394] で質問した、DevKitのMSYSでコンパイルをしたが失敗した。

###補足情報(言語/FW/ツール等のバージョンなど)
windows10 ruby 64bit 2.3.1
DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe
rubyinstaller-2.3.1-x64.exe
c:\rails\myApp>rails -v
Rails 4.2.7.1

参考したサイトは
[https://www.oiax.jp/rails/zakkan/rails_4_2_installation_on_windows.html]
Ruby on Rails 4.2 を Windows にインストールする手順をかなり丁寧に説明してみました
[https://teratail.com/questions/44394]
Ruby on Railsをcdからインストールできません。 TRAP_BEG undeclared とTRAP_END undeclared表示されます。解決の仕方がわかりません。

書籍は、
Ruby on Rails 5.0 インストール手順書
改訂3版 基礎 Ruby on Rails 基礎シリーズ

t-kuroda👍を押しています

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

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

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

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

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

guest

回答2

0

参考文献の著者です。1年以上前の質問ですが、コメントさせていただきます。

確かにMSYS2/MinGW環境ではご質問にあるような問題が発生することがあります。新しいバージョンのRubyがリリースされたけれど、sqlite3の方がそのバージョンに対応していないときに起こります。

2018年5月時点では、sqlite3がRuby 2.5に対応していません。

しかし、次の手順で解決するはずです。

bash

1$ gem uninstall -a sqlite3 2$ gem install sqlite3 --platform=ruby

投稿2018/05/03 03:49

t-kuroda

総合スコア54

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

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

0

ベストアンサー

手元にWindowsがないので未確認ですが、こちらは試して見られたでしょうか。

http://yohshiy.blog.fc2.com/blog-entry-241.html

投稿2016/08/20 00:04

shanxia

総合スコア1038

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

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

algorithm

2016/08/20 00:11

エラー返して、できませんでした。 c:\Ruby23-x64\Devkit>gem install sqlite3 --with-sqlite3-lib ERROR: While executing gem ... (OptionParser::InvalidOption) invalid option: --with-sqlite3-lib c:\Ruby23-x64\Devkit>gem install sqlite3 -v "=1.3.7" --platform=ruby -- --with-sqlite3-include=D:/redmine/sqlite-amalgamation-3071700 --with-sqlite3-lib=d:/Ruby200/bin Fetching: sqlite3-1.3.7.gem (100%) Temporarily enhancing PATH to include DevKit... Building native extensions with: '--with-sqlite3-include=D:/redmine/sqlite-amalgamation-3071700 --with-sqlite3-lib=d:/Ruby200/bin' This could take a while... ERROR: Error installing sqlite3: ERROR: Failed to build gem native extension. current directory: C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.7/ext/sqlite3 C:/Ruby23-x64/bin/ruby.exe -r ./siteconf20160820-5620-1s850c0.rb extconf.rb --with-sqlite3-include=D:/redmine/sqlite-amalgamation-3071700 --with-sqlite3-lib=d:/Ruby200/bin checking for sqlite3.h... *** 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:/Ruby23-x64/bin/$(RUBY_BASE_NAME) --with-sqlite3-dir --without-sqlite3-dir --with-sqlite3-include=${sqlite3-dir}/include --with-sqlite3-lib=${sqlite3-dir}/lib --enable-local --disable-local C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:587:in `try_cpp' from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:1144:in `block in find_header' from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for' from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone' from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:320:in `open' from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone' from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:320:in `open' from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:346:in `postpone' from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for' from C:/Ruby23-x64/lib/ruby/2.3.0/mkmf.rb:1143:in `find_header' from extconf.rb:34:in `<main>' To see why this extension failed to compile, please check the mkmf.log which can be found here: C:/Ruby23-x64/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/sqlite3-1.3.7/mkmf.log extconf failed, exit code 1 Gem files will remain installed in C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/sqlite3-1.3.7 for inspection. Results logged to C:/Ruby23-x64/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/sqlite3-1.3.7/gem_make.out
shanxia

2016/08/20 00:25

フォルダの指定はあってますか? --with-sqlite3-includeには、ダウンロードしたsqlite3のソースコードを展開したフォルダを指定します。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問