2011-03-03 147 views
1

我正在嘗試安裝pg gem當我嘗試安裝pg gem時,導致此錯誤的原因是什麼?

bens-macbook-pro:liferecord ben$ bundle config build.pg --with-pg-config=/users/ben/postgresql/bin 
bens-macbook-pro:liferecord ben$ bundle install 

我得到這個錯誤:

Installing pg (0.10.1) with native extensions /Users/ben/.rvm/rubies/ruby-1.9.2-p0/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/ben/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb --with-pg-config=/users/ben/postgresql/bin 
Using config values from /users/ben/postgresql/bin 
*** 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. 

Provided configuration options: 
    --with-opt-dir 
    --without-opt-dir 
    --with-opt-include 
    --without-opt-include=${opt-dir}/include 
    --with-opt-lib 
    --without-opt-lib=${opt-dir}/lib 
    --with-make-prog 
    --without-make-prog 
    --srcdir=. 
    --curdir 
    --ruby=/Users/ben/.rvm/rubies/ruby-1.9.2-p0/bin/ruby 
    --with-pg 
    --without-pg 
    --with-pg-dir 
    --without-pg-dir 
    --with-pg-include 
    --without-pg-include=${pg-dir}/include 
    --with-pg-lib 
    --without-pg-lib=${pg-dir}/lib 
    --with-pg-config 
extconf.rb:13:in ``': Permission denied - /users/ben/postgresql/bin --includedir (Errno::EACCES) 
    from extconf.rb:13:in `<main>' 

是什麼原因造成這個錯誤?

額外的信息:

我從one click installer安裝PostgreSQL的。

這裏是我點爲PG-配置的目錄的輸出:

bens-macbook-pro:bin ben$ ls 
clusterdb  droplang  pg_archivecleanup pg_dumpall  pgbench   postmaster 
createdb  dropuser  pg_config  pg_resetxlog  pltcl_delmod  psql 
createlang  ecpg   pg_controldata  pg_restore  pltcl_listmod  reindexdb 
createuser  initdb   pg_ctl   pg_standby  pltcl_loadmod  vacuumdb 
dropdb   oid2name  pg_dump   pg_upgrade  postgres  vacuumlo 

我運行:

Rails 3.0.1 
Ruby 1.9.2 
OSX 10.6.6 

回答

4

如果任何人有這個問題,誤差由此引起的:

bundle config build.pg --with-pg-config=/users/ben/postgresql/bin 

應該

bundle config build.pg --with-pg-config=/users/ben/postgresql/bin/pg_config 
相關問題