$ bundle install: Failed to build gem native extension
Using Snow leopard, Rails 3.0.3, ruby 1.9.2p0 and RVM. When trying to install bundle I get:
[first_app]$ bundle install
Fetching source index for http://rubygems.org/
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.7)
Using tzinfo (0.3.24)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.14)
Using actionmailer (3.0.3)
Using arel (2.0.7)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using bundler (1.0.7)
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
Installing sqlite3 (1.3.3) with nat开发者_JAVA百科ive extensions /Users/dawson/.rvm/rubies/ruby-1.9.2-p
0/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/dawson/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb
checking for sqlite3.h... *** 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.
You are missing some libraries on your system related to sqlite. This is a common problem with gems that depend on libraries which should be installed on your computer. try installing libsqlite3-dev.
I ran into almost exactly this problem (Snow Leopard, Ruby1.9.2-p0, RVM, Rails 3.1.0rc4, with developer tools installed), and resolved it by upgrading to a newer patch level of Ruby.
Using RVM, you'd write:
rvm upgrade ruby-1.9.2-p180 ruby-1.9.2-p0
(180 is the current patch, but there might be a newer one when you try this. Use the stable release version named here: http://www.ruby-lang.org/en/downloads/)
Try:
gem "sqlite-ruby", "~> 1.3.1"
You may be having issues because you're on Ruby 1.9. This gem is said to work with 1.9:
http://isitruby19.com/sqlite3-ruby
Use 'sudo bundle install' since native extensions try to write in system directories.
- sudo -s
- export ARCHFLAGS='-arch x86_64'
- export PATH=/Library/PostgreSQL/9.1/bin:${PATH}
- gem install pg
精彩评论