【问题标题】:Error installing sqlite3, Failed to build gem native extension安装 sqlite3 时出错,无法构建 gem 原生扩展
【发布时间】:2015-04-11 04:27:21
【问题描述】:

我在stackoverflow上参考了以下解决方案,但我仍然遇到同样的问题:

(Error installing mysql2: Failed to build gem native extension),

上面链接中引用的以下命令没有解决问题:

brew安装mysql

显然,问题仍然存在,返回以下输出:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... no
sqlite3 is missing. Try 'port install sqlite3 +universal',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
and check your shared library search path (the
location where your sqlite3 shared library is located).
*** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
    --with-sqlite3-dir
    --without-sqlite3-dir
    --with-sqlite3-include
    --without-sqlite3-include=${sqlite3-dir}/include
    --with-sqlite3-lib
    --without-sqlite3-lib=${sqlite3-dir}/
    --with-sqlite3lib
    --without-sqlite3lib


Gem files will remain installed in /var/folders/fb/tvgwnxc10lq6kd5xxwcg_0nw0000gn/T/bundler20150210-28601-nw7oyi/sqlite3-1.3.10/gems/sqlite3-1.3.10 for inspection.
Results logged to /var/folders/fb/tvgwnxc10lq6kd5xxwcg_0nw0000gn/T/bundler20150210-28601-nw7oyi/sqlite3-1.3.10/gems/sqlite3-1.3.10/ext/sqlite3/gem_make.out
An error occurred while installing sqlite3 (1.3.10), and Bundler cannot
continue.
Make sure that `gem install sqlite3 -v '1.3.10'` succeeds before bundling.
➜  code

非常感谢您的帮助。谢谢!

【问题讨论】:

  • 你在 RHEL/Centos/Fedora 上吗?你试过yum install sqlite-devel吗?
  • 两者都不是——我正在操作 Mac OS X Yosemite。谢谢。

标签: ruby-on-rails sqlite gem installation


【解决方案1】:

以下命令解决了我的问题:

  1. brew unlink sqlite
  2. brew install sqlite3 --universal
  3. sudo gem install sqlite3 -- --with-sqlite3-dir=/usr/local/Cellar/sqlite/3.8.8.1

我在 InfoSec 工作的老朋友帮助了我。据他说,我的 SQLite3 更新指向了错误的 bin。我希望这可以帮助任何遇到同样令人沮丧的问题的人。谢谢!

【讨论】:

  • 这对我很有用。我做了sudo gem install sqlite3 -- --with-sqlite3-dir=/usr/local/Cellar/sqlite/3.8.10.2。我在优胜美地。
  • 您必须始终检查您使用ls -l /usr/local/Cellar/sqlite/ 安装的版本并使用最新版本的文件夹。
猜你喜欢
  • 1970-01-01
  • 2021-04-19
  • 1970-01-01
  • 2011-04-06
  • 2016-01-11
  • 2016-01-17
  • 2012-11-02
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多