2010-06-08 22 views
10

Nâng cấp lên Rails 3 bằng cách bắt đầu với RVM 1.8.7. OSX 10.5.8sqlite3-ruby không thể thực hiện trên rvm 1.8.7

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 

danh sách Gem (đây là dưới RVM, theo hệ thống tôi đã có rất nhiều đá quý bao gồm các sqlite3-ruby đó là làm việc cho 1,5 năm)

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) 

Phiên bản của XCode: 3.1.1

Nghi ngờ của tôi là nó phải liên quan đến "-I/Người dùng/joshcrews/.rvm/rubies/ruby-1.8.7-p174/lib/ruby ​​/ 1.8/i686-darwin9.8.0", bởi vì i686-darwin9.8.0 không tồn tại trong tệp đó

Trả lời

16

tôi đã giúp đỡ tại Railsconf từ một (không?) Sqlite3-ruby đá quý duy trì, Aaron Patterson

Options:

  • Nhận trên Snow Leopard
  • Install sqlite3-ruby 1.2.5
  • Cài đặt sqlite3 qua macports trước

Bật Snow Leopard

sqlite3-ruby> = 1.3.0 chưa được kiểm tra cho OSX 10.5. Snow Leopard sẽ làm việc

Install sqlite3-ruby 1.2.5

gem install sqlite3-ruby -v 1.2.5 

Sau đó thiết lập mỗi Rails3 Gemfile nói

gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3' 

Cài đặt sqlite3 này qua macports đầu tiên

sudo port install sqlite3 
gem install sqlite3-ruby 
+0

Cảm ơn bạn, phụ thuộc phiên bản đã giúp tôi quá. Tôi đã có thể giải quyết một tình huống tương tự trên OS X 10.5/Ruby 1.8.6/Rails 2.3.8 với 'config.gem 'sqlite3-ruby',: version => '~> 1.2.0',: lib => ' sqlite3'' – conny

+1

Như Bryce đã đề cập: Như thay thế cho MacPorts, bạn có thể muốn sử dụng homebrew. 'brew install sqlite; đá quý cài đặt sqlite3-ruby' giải quyết nó đẹp. – romeroabelleira

+0

"Bạn phải cài đặt công cụ SQLite để xây dựng mô-đun này [sqlite3-ruby]." (http://rubygems.org/gems/sqlite3-ruby) Do đó, 'sudo port install sqlite3', tôi đoán vậy. –

3

Tôi không chắc chắn 100% những gì đang gây ra vấn đề, nhưng tôi đã nhận nó hoạt động bằng cách cài đặt sqlite3 qua homebrew: http://github.com/mxcl/homebrew

Sau đó, đá quý được cài đặt tốt. Phiên bản của sqlite3 của Leopard không được tương thích với phiên bản mới của sqlite3-ruby.

1

Tôi có cùng một vấn đề trên Linux, và chạy dưới hai lệnh. Hoạt động hoàn hảo.

sudo aptitude install sqlite3 libsqlite3-dev 
sudo gem install sqlite3-ruby 
2

Nếu bạn đã cài đặt macro hoặc khối cài đặt sqlite3 và bạn vẫn gặp sự cố, bạn có thể phải chỉ định tùy chọn xây dựng khi cài đặt đá quý.

Ví dụ:

gem install sqlite3 -v 1.3.5 -- --with-sqlite3-include=/opt/local/include --with-sqlite3-lib=/opt/local/lib 

Nếu bạn đang ở trên homebrew, sử dụng/usr/local thay vì/opt/local.

Để cấu hình bundler nhớ các tùy chọn xây dựng cho sqlite3 (chạy "bó giúp đỡ config" để biết thêm):

bundle config build.sqlite3 --with-sqlite3-include=/opt/local/include --with-sqlite3-lib=/opt/local/lib 
Các vấn đề liên quan