繁体   English   中英

$ bundle install:无法构建gem原生扩展

[英]$ bundle install: Failed to build gem native extension

使用Snow leopard,Rails 3.0.3,ruby 1.9.2p0和RVM。 当我尝试安装捆绑包时,我得到:

[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.

您缺少系统上与sqlite相关的库。 这是依赖于应安装在您的计算机上的库的宝石的常见问题。 尝试安装libsqlite3-dev。

我几乎遇到了这个问题(Snow Leopard,Ruby1.9.2-p0,RVM,Rails 3.1.0rc4,安装了开发人员工具),并通过升级到更新的Ruby补丁级别来解决它。

使用RVM,你会写:

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

(180是当前的补丁,但是当您尝试此补丁时可能会有更新的补丁。使用此处命名的稳定版本: http//www.ruby-lang.org/en/downloads/

尝试:

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

您可能遇到问题,因为您使用的是Ruby 1.9。 据说这个宝石可用于1.9:

http://isitruby19.com/sqlite3-ruby

使用'sudo bundle install',因为本机扩展尝试在系统目录中写入。

  1. sudo -s
  2. export ARCHFLAGS =' - arch x86_64'
  3. export PATH = / Library / PostgreSQL / 9.1 / bin:$ {PATH}
  4. 宝石安装pg

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM