sqlite3-ruby gem在ubuntu上找不到sqlite3.h

时间:2010-09-26 23:14:46

标签: ruby ubuntu sqlite sqlite3-ruby

尝试在ubuntu上获取Rails,我在安装sqlite3-ruby时遇到问题 - 显然找不到sqlite3.h。我可以找到错误的所有引用都表明问题是:未安装sqlite3头文件,或者make无法找到它们。在我看来,我已经解决了这两个问题,我仍然看到了同样的问题。

不知道这里发生了什么。版本不匹配,也许?这是在ubuntu 10.04.1上使用ruby 1.8.7,sqlite 3.6.22-1,gem 1.3.5和sqlite3-ruby 1.3.1。

david@li88-188:~$ sudo apt-get install sqlite3

[...成功安装......]

Setting up sqlite3 (3.6.22-1) ...
david@li88-188:~$ sudo apt-get install libsqlite3-dev

[...成功安装......]

Setting up libsqlite3-dev (3.6.22-1) ...
david@li88-188:~$ sudo gem install sqlite3-ruby
Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3-ruby:
 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'
*** 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.

[...配置选项等....]

david@li88-188:~$ cat /var/lib/gems/1.8/gems/sqlite3-ruby-1.3.1/ext/sqlite3/mkmf.log 
find_header: checking for sqlite3.h... -------------------- no

"gcc -E -I. -I/usr/lib/ruby/1.8/i486-linux -I. -I/usr/local/include -I/opt/local/include -I/usr/include  -D_FILE_OFFSET_BITS=64  -fno-strict-aliasing -g -g -O2  -fPIC   -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include <sqlite3.h>
/* end */

--------------------

请注意,/usr/include位于参数列表中。

david@li88-188:~$ ls -l /usr/include/sqlite3.h 
-rw-r--r-- 1 root root 268351 2010-02-08 03:59 /usr/include/sqlite3.h

请注意该文件在那里。

3 个答案:

答案 0 :(得分:41)

在我的情况下,我必须安装libsqlite3-dev

sudo apt-get install libsqlite3-dev

答案 1 :(得分:4)

没关系。 gcc本身没有安装,正如我在尝试使用更好的错误消息安装另一个gem时发现的那样。

答案 2 :(得分:1)

https://help.ubuntu.com/community/RubyOnRails这里是为Ubuntu设置RoR开发环境的基本教程,其中介绍了每一步。祝你好运!