2011-11-14 47 views
4

我想用命令寶石SQLITE3爲Rails 3.1

rails new myApp

創建對myApp但它給出了一個錯誤:

Installing sqlite3 (1.3.4) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb checking for sqlite3.h... no sqlite3.h is missing. Try 'port install sqlite3 +universal' or 'yum install sqlite3-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=/usr/bin/ruby1.8 --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 /usr/lib/ruby/gems/1.8/gems/sqlite3-1.3.4 for inspection. Results logged to /usr/lib/ruby/gems/1.8/gems/sqlite3-1.3.4/ext/sqlite3/gem_make.out An error occured while installing sqlite3 (1.3.4), and Bundler cannot continue. Make sure that gem install sqlite3 -v '1.3.4' succeeds before bundling.

我該怎麼辦?謝謝

回答

13

確保你已經安裝了SQLite3的開發頭文件。

例如:

在Ubuntu,你可以使用apt-get install libsqlite3-dev

在Mac上安裝自制軟件:brew install sqlite

4

我發現每當我在Ubuntu上重新安裝rails時運行此命令都非常有幫助。這通常會處理超常見的zlib和sqlite3錯誤。

在/ usr/bin中/ apt-get的安裝建立必要的野牛OpenSSL的libreadline6 libreadline6-dev的捲曲混帳核心的zlib1g的zlib1g-dev的的libssl-dev的libyaml-dev的libsqlite3-0 libsqlite3-dev的sqlite3的的libxml2-dev的的libxslt-dev的autoconf的libc6-dev ncurses-dev