雪豹升级->重新安装sqlite3-ruby gem问题 [英] Snow Leopard upgrade -> reinstalling sqlite3-ruby gem problem

查看:201
本文介绍了雪豹升级->重新安装sqlite3-ruby gem问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到了ruby 1.8.7(本机编译),rails 2.3.4,OSX 10.6.2和sqlite3-ruby.

I got ruby 1.8.7 (native compiled), rails 2.3.4, OSX 10.6.2 and also sqlite3-ruby.

访问Rails应用时出现的错误是

The error I'm getting when accessing the rails app is

NameError:未初始化的常量SQLite3 :: Driver :: Native :: Driver :: API

NameError: uninitialized constant SQLite3::Driver::Native::Driver::API

历史记录:
通过使用FW电缆将我的应用程序从旧的Macbook迁移到新的Mac,我升级到了雪豹.几个月来一切都运行良好,但是昨天我需要安装watir,它依赖于rb-appscript,由于libsqlite3.dylib中出现错误的体系结构"错误,因此无法构建.我认为构建是在旧计算机上完成的,所以我想重建sqlite3-ruby:

History:
I upgraded to snow leopard by migrating my apps with a FW-cable from my old macbook to the new one. Everything was running perfectly for months, but Yesterday I needed to install watir, which was dependant on rb-appscript, which didn't build due a "wrong architecture" error in libsqlite3.dylib. I figured the build was made on the old machine, so i wanted to rebuild sqlite3-ruby:

$ sudo gem卸载sqlite3-ruby

$ sudo gem uninstall sqlite3-ruby

$ sudo gem install sqlite3-ruby

$ sudo gem install sqlite3-ruby

构建本机扩展.这可能需要一段时间...
错误:安装sqlite3-ruby时出错:
错误:无法生成gem本机扩展.

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

/usr/local/bin/ruby​​ extconf.rb
正在检查-lrt中的fdatasync()...否
正在检查sqlite3.h ...是
正在检查-lsqlite3中的sqlite3_open()...否
* extconf.rb失败*
由于某些原因(可能缺少
)而无法创建Makefile 必要的库和/或标头.检查mkmf.log文件以获取更多信息
细节.您可能需要配置选项.

/usr/local/bin/ruby extconf.rb
checking for fdatasync() in -lrt... no
checking for sqlite3.h... yes
checking for sqlite3_open() in -lsqlite3... no
* 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库无法正常工作.我试图安装macports sqlite3(sudo端口安装sqlite3),而是使用它,但是结果相同...所以我从头开始重建sqlite3.此后,该宝石现在可以完美构建,但无法在轨道上工作,从而在本文顶部给出了错误.

It seems like the sqlite3 libs are not working properly. I've tried to install macports sqlite3 (sudo port install sqlite3) and use that instead, but with same result... so i rebuild sqlite3 from scratch.. download->configure->make->make install. After that, the gem now builds perfectly, but doesn't work in rails, giving the error in the top of this article.

我真的不确定从这里要去哪里,因为我已经尝试了以下方法

I'm not really sure where to go from here because I've tried the following

  1. 从最新来源重建sqlite3( http://www.sqlite.org/download.html)
  2. 重新安装了sqlite3-ruby(sudo gem卸载sqlite3-ruby&& sudo gem install sqlite3-ruby)
  3. 从macports使用过的sqlite3(sudo端口安装sqlite3&& sudo gem安装sqlite3-ruby)
  4. 重新安装导轨(sudo gem install rails sqlite3-ruby),并将environment.rb更新为rails 2.3.5.
  1. Rebuild sqlite3 from newest source (http://www.sqlite.org/download.html)
  2. Reinstalled sqlite3-ruby (sudo gem uninstall sqlite3-ruby && sudo gem install sqlite3-ruby)
  3. Used sqlite3 from macports (sudo port install sqlite3 && sudo gem install sqlite3-ruby)
  4. Reinstalled rails (sudo gem install rails sqlite3-ruby ) and updated environment.rb to rails 2.3.5.

无济于事,我仍然收到此错误:

No avail, I still get this error:

NameError:未初始化的常量SQLite3 :: Driver :: Native :: Driver :: AP
来自/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:105:在const_missing'
from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.5/lib/sqlite3/driver/native/driver.rb:76:in
open'
中 来自/usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.5/lib/sqlite3/database.rb:76:在初始化"中

NameError: uninitialized constant SQLite3::Driver::Native::Driver::AP
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:105:in const_missing'
from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.5/lib/sqlite3/driver/native/driver.rb:76:in
open'
from /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.5/lib/sqlite3/database.rb:76:in `initialize'

顺便说一句,我已经从Snow Leopard CD中安装了Xcode.

Btw, I have Xcode installed from the Snow Leopard CD.

我该怎么做才能解决问题?

What can i do to solve the problem?

推荐答案

感谢您的回答.这是我为解决问题所做的事情:

Thanks for the answers. Here is what i did to solve the problem:

  1. 将ruby1.8.7完成重新安装到/usr/local的操作,请参见此处: http ://hivelogic.com/articles/ruby-rails-leopard

注意:在Mac上重新编译ruby时,readline无法正常工作,因此我也必须从头开始构建它,并确保添加--with-readline-dir选项进行配置:

Note: readline wasn't working when recompiling ruby on my mac, so i had to build that too from scratch and make sure to add the --with-readline-dir option to configure:

./configure --enable-shared --enable-pthread CFLAGS = -D_XOPEN_SOURCE = 1 --prefix =/usr/local --with-readline-dir =/usr/local

./configure --enable-shared --enable-pthread CFLAGS=-D_XOPEN_SOURCE=1 --prefix=/usr/local --with-readline-dir=/usr/local

  • 将sqlite3重新安装到/usr/local

  • Complete reinstall of sqlite3 to /usr/local

    使用sudo gem install XXX重建系统上的所有gem,包括sqlite3-ruby.这仅对于平台特定的gem才是必需的,但我发现仅将所有内容安装在oneliner中它就会更快:

    Rebuild all gems on the system with sudo gem install XXX, including sqlite3-ruby. This is only necessary with platform specific gems, but i found it to be faster just to install everything in a oneliner:

    sudo gem install gem1 gem2 ... gemN --no-ri --no-rdoc

    sudo gem install gem1 gem2 ... gemN --no-ri --no-rdoc

  • 我尝试使用ruby1.9,但是由于gems和插件的依赖关系破裂,一切都停止了工作,因此,除非您准备进行大量的调试工作并且知道如何还原旧系统,否则我不建议切换到1.9!

    I tried to go with ruby1.9 but everything stopped working due to broken dependencies in gems and plugins, so I wouldn't recommend switching to 1.9 unless you are up for some heavy debugging and know how to restore your old system!

    最后一切再次运行!

    这篇关于雪豹升级->重新安装sqlite3-ruby gem问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆