首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >sqlite3-ruby无法在rvm 1.8.7上运行

sqlite3-ruby无法在rvm 1.8.7上运行
EN

Stack Overflow用户
提问于 2010-06-09 04:00:15
回答 4查看 10.7K关注 0票数 10

从RVM 1.8.7开始升级到Rails 3。OSX 10.5.8

代码语言:javascript
复制
Output:
josh-crewss-macbook:~ joshcrews$ gem install sqlite3-rubyBuilding native extensions.  This could take a while...ERROR:  Error installing sqlite3-ruby:  ERROR: Failed to build gem native extension.
/Users/joshcrews/.rvm/rubies/ruby-1.8.7-p174/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... no
checking for sqlite3_column_database_name()... no
checking for sqlite3_enable_load_extension()... no
checking for sqlite3_load_extension()... no
creating Makefile

make
gcc -I. -I. -I/Users/joshcrews/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/1.8/i686-darwin9.8.0 -I. -I/usr/local/include -I/opt/local/include -I/usr/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -g -O2  -fno-common -pipe -fno-common  -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline  -c database.c
database.c: In function ‘deallocate’:
database.c:17: warning: implicit declaration of function ‘sqlite3_next_stmt’
database.c:17: warning: assignment makes pointer from integer without a cast
database.c: In function ‘initialize’:
database.c:76: warning: implicit declaration of function ‘sqlite3_open_v2’
database.c:79: error: ‘SQLITE_OPEN_READWRITE’ undeclared (first use in this function)
database.c:79: error: (Each undeclared identifier is reported only once
database.c:79: error: for each function it appears in.)
database.c:79: error: ‘SQLITE_OPEN_CREATE’ undeclared (first use in this function)
database.c: In function ‘set_sqlite3_func_result’:
database.c:277: error: ‘sqlite3_int64’ undeclared (first use in this function)
database.c: In function ‘rb_sqlite3_func’:
database.c:311: warning: passing argument 1 of ‘ruby_xcalloc’ as signed due to prototype
database.c: In function ‘rb_sqlite3_step’:
database.c:378: warning: passing argument 1 of ‘ruby_xcalloc’ as signed due to prototype
make: *** [database.o] Error 1

Gem list (这些是在RVM下的,在system下我有更多的Gem,包括已经工作了1.5年的sqlite3-ruby )

代码语言:javascript
复制
josh-crewss-macbook:~ joshcrews$ gem list

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.0.beta3)
actionpack (3.0.0.beta3)
activemodel (3.0.0.beta3)
activerecord (3.0.0.beta3)
activeresource (3.0.0.beta3)
activesupport (3.0.0.beta3, 2.3.8)
arel (0.3.3)
builder (2.1.2)
bundler (0.9.25)
capybara (0.3.8)
configuration (1.1.0)
cucumber (0.7.2)
cucumber-rails (0.3.1)
culerity (0.2.10)
database_cleaner (0.5.2)
diff-lcs (1.1.2)
erubis (2.6.5)
ffi (0.6.3)
gherkin (1.0.30)
i18n (0.4.0, 0.3.7)
json_pure (1.4.3)
launchy (0.3.5)
mail (2.2.1)
memcache-client (1.8.3)
mime-types (1.16)
nokogiri (1.4.2)
polyglot (0.3.1)
rack (1.1.0)
rack-mount (0.6.3)
rack-test (0.5.4)
rails (3.0.0.beta3)
railties (3.0.0.beta3)
rake (0.8.7)
rdoc (2.5.8)
rspec (2.0.0.beta.10, 2.0.0.beta.8)
rspec-core (2.0.0.beta.10, 2.0.0.beta.8)
rspec-expectations (2.0.0.beta.10, 2.0.0.beta.8)
rspec-mocks (2.0.0.beta.10, 2.0.0.beta.8)
rspec-rails (2.0.0.beta.10, 2.0.0.beta.8)
rubygems-update (1.3.7)
selenium-webdriver (0.0.20)
spork (0.8.3)
term-ansicolor (1.0.5)
text-format (1.0.0)
text-hyphen (1.0.0)
thor (0.13.6)
treetop (1.4.8)
trollop (1.16.2)
tzinfo (0.3.22)
webrat (0.7.1)

XCode版本: 3.1.1

我怀疑这与"-I/Users/joshcrews/.rvm/rubies/ruby-1.8.7-p174/lib/ruby/1.8/i686-darwin9.8.0",有关,因为该文件中不存在i686-darwin9.8.0

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2010-06-10 03:22:20

我在Railsconf得到了一个(the?)sqlite3-ruby gem维护者,Aaron Patterson

选项:

  • Get on Snow Leopard
  • Install sqlite3 - 1.2.5
    • Install sqlite3 via macports first

雪豹 Get

sqlite3-ruby >= 1.3.0未针对osx10.5进行测试。雪豹应该可以工作

安装sqlite3-ruby 1.2.5

代码语言:javascript
复制
gem install sqlite3-ruby -v 1.2.5

然后将每个Rails3 Gemfile设置为这样

代码语言:javascript
复制
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'

首先通过macports安装sqlite3

代码语言:javascript
复制
sudo port install sqlite3
gem install sqlite3-ruby
票数 16
EN

Stack Overflow用户

发布于 2010-06-09 09:15:40

我不是百分之百确定是什么导致了这个问题,但我通过自制的http://github.com/mxcl/homebrew安装了sqlite3来解决这个问题

在那之后,gem安装得很好。Leopard的sqlite3版本必须与sqlite3-ruby的新版本不兼容。

票数 3
EN

Stack Overflow用户

发布于 2012-01-06 00:47:02

如果您已经安装了sqlite3 macport或brew,但仍然存在此问题,则在安装gem时可能需要指定构建选项。

示例:

代码语言:javascript
复制
gem install sqlite3 -v 1.3.5 -- --with-sqlite3-include=/opt/local/include --with-sqlite3-lib=/opt/local/lib

如果您使用的是自制软件,请使用/usr/local而不是/opt/local。

要配置bundler以记住sqlite3的构建选项(运行"bundle help config“获取更多信息):

代码语言:javascript
复制
bundle config build.sqlite3 --with-sqlite3-include=/opt/local/include --with-sqlite3-lib=/opt/local/lib
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3000819

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档