2011-02-19 56 views
7

Possible Duplicate:
sqlite3-ruby install error on Ubuntu我无法安装sqlite3的宝石

嗨 我使用apt-get安装在我的VPS这是运行Ubuntu 10 sqlite3的,我也没有问题运行sqlite3的。但是当我尝试使用gem install sqlite3时,出现此错误:

[email protected]:/# gem install sqlite3 
Building native extensions. This could take a while... 
ERROR: Error installing sqlite3: 
    ERROR: Failed to build gem native extension. 

     /usr/local/bin/ruby 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/local/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 


Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.3 for inspection. 
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/sqlite3-1.3.3/ext/sqlite3/gem_make.out 

有什么建议吗?

+0

你应该更新到Ruby 1.9.2,它修复了很多问题。 –

+0

红宝石已经1.9.2,我自己编译它 – mko

回答

19

您需要先安装源码开发头文件,因此它可以编译宝石对他们说:

sudo apt-get install libsqlite3-dev 

然后尝试安装宝石。

+0

它的工作!我想知道什么是开发标题,它用于什么? – mko

+0

sqlite3 gem是一个Ruby C扩展,因此它必须被编译。由于它需要在编译中包含sqlite3库头文件,因此需要该包。 –

+0

工作就像一个魅力!谢谢! –