6

我正在尝试 rvm,并用它安装了 ruby​​ 1.9.2 和 rails 3。我需要重新安装 sqlite3-ruby gem(因为 rvm 为不同版本的 ruby​​ 将所有 gem 分开)。

问题是,当我尝试时,我得到:

     gem install sqlite3-ruby
/home/jenny/.rvm/rubies/ruby-1.9.2-p0/bin/gem:4: warning: Insecure world writable dir /home/jenny/.rvm/gems/ruby-1.9.2-p0/bin in PATH, mode 040777
Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3-ruby:
    ERROR: Failed to build gem native extension.

/home/jenny/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... yes
checking for sqlite3_initialize()... yes
checking for sqlite3_next_stmt()... yes
checking for sqlite3_column_database_name()... yes
checking for sqlite3_enable_load_extension()... no
checking for sqlite3_load_extension()... no
creating Makefile

make
gcc -I. -I/home/jenny/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/i686-linux -I/home/jenny/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby/backward -I/home/jenny/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1 -I. -DHAVE_RB_PROC_ARITY -DHAVE_SQLITE3_INITIALIZE -DHAVE_SQLITE3_NEXT_STMT -DHAVE_SQLITE3_COLUMN_DATABASE_NAME -I/usr/local/include -I/opt/local/include -I/sw/local/include -I/usr/include  -D_FILE_OFFSET_BITS=64  -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long  -fPIC  -o exception.o -c exception.c
In file included from ./sqlite3_ruby.h:42,
                 from exception.c:1:
./backup.h:7: error: expected specifier-qualifier-list before ‘sqlite3_backup’
make: *** [exception.o] Error 1

我真的不太清楚该怎么做......我之前已经在这台机器上安装了 sqlite3-ruby(使用 rails 2.3.5)当我尝试重新安装这个 gem(使用 rvm 系统设置)它没有安装在 ruby​​ 1.8.7 环境中,要么。

rvm 是否破坏了宝石?新 gem 是否与我的操作系统不兼容(我正在运行 opensuse linux)

编辑:当我尝试在我的常规 ruby​​ 环境中重新安装(卸载而不是再次安装)sqlite3-ruby 时,我得到了同样的错误,但随后看到我的 gem 列表中列出的 sqlite3-ruby(不确定它是否以某种方式从备份中恢复,或安装尽管有错误)

4

4 回答 4

6

我会投票或评论布伦南的回答,但我还没有足够的分数来做这件事。我想我会留下这个答案,以防它对其他人有帮助:我在这个上面花了一段时间......我安装了 Ruby 1.9.1 和 Rails 3.0.3 并且可以正常工作,但决定转向 RVM。根据说明安装了 RVM,然后再次安装了 rails,所有的肉汁......然后尝试捆绑安装并使用 sqlite3 遇到此错误:

Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3:
    ERROR: Failed to build gem native extension.

/Users/Jasonp/.rvm/rubies/ruby-1.9.2-p136/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'
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.

我知道我之前的配置中使用过 SQLite3,所以我去找了原来的目录。这是 usr/local/sqlite3

我尝试使用它作为--with-sqlite3-dir=路径,但没有奏效。然后只是为了好玩,我尝试了:

gem install sqlite3-ruby -- --with-sqlite3-dir=/usr/local/lib

无论出于何种原因,这都有效。所以,以防万一有人

于 2011-01-20T01:13:56.007 回答
4

你可以试试

gem install sqlite3-ruby -- --with-sqlite3-dir=/path/to/your/sqlite3

如果这不起作用,您可能会尝试更新您的 sqlite3,因为 3.6.4 相当旧,而且我认为 Ruby sqlite 的较新版本存在一些问题。

(最可能的原因是您对两者的回答不同是因为版本 2 和 3 之间发生了重大变化——我相信主要是处理 Unicode——而且一些程序仍然使用 2,而不是 3。)

于 2010-12-15T14:38:47.607 回答
3

当我从源代码安装 sqlite3 时,它将包含文件放在 /usr/local/include

我试过

gem install sqlite3-ruby -- --with-sqlite3-dir=/usr/local/lib

它终于安装了。

于 2010-12-30T17:41:07.113 回答
0

在 ubuntu 9.04 上,我还必须下载 sqlite 并从源代码安装

于 2011-01-05T22:39:52.747 回答