2
0

More than 3 years have passed since last update.

【Ruby】ERROR: Error installing sqlite3: ERROR: Failed to build gem native extension.が表示される【環境構築時エラー】

Posted at

sqlite3をインストール時エラー

sqlite3をインストールする為に以下gemコマンドを実行しました。

gem install sqlite3 --platform=ruby -- --with-sqlite3-include=G:/sqli
te3 --with-sqlite3-lib=G:\uru

するとエラーが生じました。

Temporarily enhancing PATH for MSYS/MINGW...
Installing required msys2 packages: mingw-w64-x86_64-sqlite3
警告: 公開キーリングが見つかりません。'pacman-key --init' を実行済みですか?
エラー: mingw32: キー "AD351C50AE085775EB59333B5F92EFC1A47D45A1" は不明です
エラー: キー "AD351C50AE085775EB59333B5F92EFC1A47D45A1" をリモートで検索できませ
んでした
エラー: mingw64: キー "AD351C50AE085775EB59333B5F92EFC1A47D45A1" は不明です
エラー: キー "AD351C50AE085775EB59333B5F92EFC1A47D45A1" をリモートで検索できませ
んでした
エラー: msys: キー "AD351C50AE085775EB59333B5F92EFC1A47D45A1" は不明です
エラー: キー "AD351C50AE085775EB59333B5F92EFC1A47D45A1" をリモートで検索できませ
んでした
エラー: データベース 'mingw32' は無効です (無効または破損したデータベース (PGP
鍵))
エラー: データベース 'mingw64' は無効です (無効または破損したデータベース (PGP
鍵))
エラー: データベース 'msys' は無効です (無効または破損したデータベース (PGP 鍵))

pacman failed with the following output:
Building native extensions with: '--with-sqlite3-include=G:/sqlite3 --with-sqlit
e3-lib=G:\uru'
This could take a while...
ERROR:  Error installing sqlite3:
        ERROR: Failed to build gem native extension.

    current directory: G:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/sqlite3-1.4.2/ext/
sqlite3
G:/Ruby26-x64/bin/ruby.exe -I G:/Ruby26-x64/lib/ruby/2.6.0 -r ./siteconf20200402
-9828-740tem.rb extconf.rb --with-sqlite3-include\=G:/sqlite3 --with-sqlite3-lib
\=G:\\uru
checking for sqlite3.h... yes
checking for pthread_create() in -lpthread... yes
checking for -ldl... no
checking for sqlite3_libversion_number() in -lsqlite3... no
sqlite3 is missing. Install SQLite3 from http://www.sqlite.org/ first.
*** 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.

調べてみたら、こちらからダウンロードした
・sqlite-amalgamation-3310100.zip
・sqlite-dll-win64-x64-3310100.zip
を解凍したファイルの「sqlite3.h」「sqlite3.dll」の配置が悪かったようです。

Pathが通ってる「G:\Ruby26-x64\bin」に「sqlite3.h」「sqlite3.dll」の両方のファイルをいれ以下コマンドを入力しました。

gem install sqlite3 --platform=ruby -- --with-sqlite3-include=G:\Ruby26-x64\bin --with-sqlite3-lib=G:\Ruby26-x64\bin
pacman failed with the following output:
Building native extensions with: '--with-sqlite3-include=G:\Ruby26-x64\bin --wit
h-sqlite3-lib=G:\Ruby26-x64\bin'
This could take a while...
Successfully installed sqlite3-1.4.2
Parsing documentation for sqlite3-1.4.2
Installing ri documentation for sqlite3-1.4.2
Done installing documentation for sqlite3 after 5 seconds
1 gem installed

今度は無事インストール出来ました!!

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0