Rails 3不会使用rvm安装sqlite3-ruby gem?
我正在尝试 rvm,并用它安装了 ruby 1.9.2 和 Rails 3。我需要重新安装 sqlite3-ruby gem(因为 rvm 将所有 gem 针对不同版本的 ruby 分开)。
问题是,当我尝试时,我得到:
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 时,我收到相同的错误,但随后看到sqlite3-ruby 列在我的 gem 列表中(不确定它是否以某种方式从备份中恢复,或者尽管出现错误仍然安装)
I'm trying out rvm, and installed ruby 1.9.2 and rails 3 with it. I need to re-install the sqlite3-ruby gem (since rvm keeps all gems separate for different versions of ruby).
The problem is, when I try, I get:
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
I'm really not quite sure what to make of it... I HAVE installed sqlite3-ruby on this machine before (with rails 2.3.5) When I try to reinstall this gem (using rvm system settings) it doesn't install in a ruby 1.8.7 enviornment, EITHER.
Did rvm break the gem? Is the new gem just not compatible with my OS (i'm running opensuse linux)
Edit: When I try re-installing (uninstalling than installing again) sqlite3-ruby in my regular ruby environment, I get the same error, but then see sqlite3-ruby listed in my gem list (not sure if it's somehow restoring from backup, or installing despite the error)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我会投票赞成或评论布伦南的答案,但我还没有足够的积分来这样做。我想我会留下这个答案,以防它对其他人有帮助:我在这个问题上花了一段时间...我安装了 Ruby 1.9.1 和 Rails 3.0.3 并正在运行,但决定迁移到 RVM。按照指示安装了RVM,然后再次安装了rails,一切都很顺利...然后尝试捆绑安装并在sqlite3中遇到了这个错误:
我知道我之前的配置中已经有SQLite3工作,所以我去找了原来的目录。这是 usr/local/sqlite3
我尝试使用它作为
--with-sqlite3-dir=
路径,但没有成功。然后只是为了好玩我尝试了:无论出于何种原因,这都有效。所以,以防万一有人
I'd vote up or comment on Brennan's answer but I don't have enough points to do that yet. I figured I'd leave this answer in case it helps anyone else: I've spent a while on this one...I had Ruby 1.9.1 and Rails 3.0.3 installed and working but decided to move to RVM. Installed RVM according to directions and then installed rails again, all gravy...then tried to bundle install and ran into this error with sqlite3:
I know I had SQLite3 working before in my previous config, so I went to find the original dir. which was usr/local/sqlite3
I tried using that as the
--with-sqlite3-dir=
path but didn't work. Then just for fun I tried:and for wahtever reason, that worked. So, just in case someone
你可以尝试
如果这不起作用,你可以尝试更新你的sqlite3,3.6。 4 相当旧,我认为较新版本的 Ruby sqlite 对于旧版本存在问题。
(您得到这两个版本不同答案的最可能原因是版本 2 和版本 3 之间发生了重大变化 - 我相信主要是处理 Unicode - 并且某些程序仍然使用 2,而不是 3。)
You could try
And if that doesn't work, you might try to update your sqlite3, 3.6.4 is rather old, and I think the newer versions of Ruby sqlite have problems with something that old.
(And the most likely reason that you're getting different answers with the two is that between versions 2 and 3 was a major change -- mostly dealing with Unicode, I believe -- and some programs still use 2, not 3.)
当我从源代码安装 sqlite3 时,它将包含文件放置在 /usr/local/include 中,
我尝试过
,最终安装了。
When I installed sqlite3 from source it placed the include files in /usr/local/include
I tried
and it finally installed.
在 ubuntu 9.04 上我还必须下载 sqlite 并从源代码安装
on ubuntu 9.04 I also had to download sqlite and install from source