1

我安装了 rbenv、ruby 和 rails,但是创建新 rails 项目的命令导致 sqlite 出现异常。

rails new first_app
.
.
.
Using sass (3.2.3) 
Using sass-rails (3.2.5) 
Installing sqlite3 (1.3.6) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/home/alundgren/.rbenv/versions/1.9.3-p327/bin/ruby extconf.rb 
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite-devel' 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=/home/alundgren/.rbenv/versions/1.9.3-p327/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}/lib
    --enable-local
    --disable-local


Gem files will remain installed in /home/alundgren/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.6 for inspection.
Results logged to /home/alundgren/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.6/ext/sqlite3/gem_make.out
An error occurred while installing sqlite3 (1.3.6), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.6'` succeeds before bundling.

我试过安装sqlitegem 和 rehashing rbenv,但同样的错误。有没有人对如何解决这个问题有任何想法,确切的宝石名称是什么等?

4

3 回答 3

1

我有同样的问题,我在 ubuntu 上安装了 sqlite 包:

apt-get install libsqlite3-dev
于 2013-01-11T22:53:57.687 回答
0

You do not seem to have sqlite installed on your box. The gem will not installed without the underlying being present.

Please do:

  • macosx: brew install sqlite
  • enterprise linux: sudo yum install libsqlite3-dev
  • ubuntu: sudo apt-get install libsqlite3-dev
于 2013-05-08T10:00:49.110 回答
0

问题是您缺少编译 mysql 适配器所需的头文件。该错误提示“尝试'port install sqlite3 +universal'或'yum install sqlite-devel'并检查您的共享库搜索路径(您的sqlite3共享库所在的位置)”。我会先这样做,因为这将确保您的机器上有正确的头文件。一旦你有了它们,你可能必须向编译器指定文件的位置,“--with-sqlite3-include”指令可能会解决问题。

于 2012-11-26T15:51:24.083 回答