$ bundle install: Failed to create custom gem extension

Using Snow leopard, Rails 3.0.3, ruby ​​1.9.2p0 and RVM. When I try to install the package, 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 native 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. 
+6
ruby-on-rails
source share
5 answers

You are missing some of the sqlite related libraries on your system. This is a common problem with gems, which depend on the libraries that must be installed on your computer. try installing libsqlite3-dev.

+5
source share

I ran into almost this problem (Snow Leopard, Ruby1.9.2-p0, RVM, Rails 3.1.0rc4, with installed developer tools) and resolved it by updating to a newer level of Ruby fix.

Using RVM, you should write:

 rvm upgrade ruby-1.9.2-p180 ruby-1.9.2-p0 

(180 is the current patch, but when you try it may be a newer one). Use the stable version of the version named here: http://www.ruby-lang.org/en/downloads/ )

+1
source share

Try:

 gem "sqlite-ruby", "~> 1.3.1" 

You may have problems because you are on Ruby 1.9. This gem is said to work with 1.9:

http://isitruby19.com/sqlite3-ruby

0
source share

Use the 'sudo bundle install' as you try to write your own extensions to system directories.

0
source share
  • sudo -s
  • export ARCHFLAGS = '- arch x86_64'
  • export PATH = / Library / PostgreSQL / 9.1 / bin: $ {PATH}
  • gem pg installation
0
source share

All Articles