2012-12-02 188 views
3

我一直在嘗試在我的ruby 1.9.3-p286上安裝「pg」gem,但沒有任何效果。無法在Ubuntu 12.10(AMD64)上安裝gem「pg」

我已經安裝了postgresql(9.1),libpq-dev和其他一些像postgresql-server-dev-9.1。我試圖將「with-pg-config」標誌傳遞給gem install,但似乎沒有任何工作。

每次我嘗試安裝它輸出這樣的寶石:

Building native extensions. This could take a while... 
ERROR: Error installing pg: 
    ERROR: Failed to build gem native extension. 

     /home/lynux/.rvm/rubies/ruby-1.9.3-p286/bin/ruby extconf.rb 
checking for pg_config... yes 
Using config values from /usr/bin/pg_config 
checking for libpq-fe.h... yes 
checking for libpq/libpq-fs.h... yes 
checking for pg_config_manual.h... yes 
checking for PQconnectdb() in -lpq... no 
checking for PQconnectdb() in -llibpq... no 
checking for PQconnectdb() in -lms/libpq... no 
Can't find the PostgreSQL client library (libpq) 
*** 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 
    --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=/home/lynux/.rvm/rubies/ruby-1.9.3-p286/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 
    --without-pg-config 
    --with-pg_config 
    --without-pg_config 
    --with-pqlib 
    --without-pqlib 
    --with-libpqlib 
    --without-libpqlib 
    --with-ms/libpqlib 
    --without-ms/libpqlib 


Gem files will remain installed in /home/lynux/.rvm/gems/[email protected]/gems/pg-0.14.1 for inspection. 
Results logged to /home/lynux/.rvm/gems/[email protected]/gems/pg-0.14.1/ext/gem_make.out 

我在做什麼錯?在嘗試安裝gem之前還有什麼我應該做的嗎?

預先感謝您。

[編輯]

好了,joelparkerhenderson的回答讓我覺得,有可能我的一些錯誤路徑和圖書館,並就進一步挖掘一點點去..

我發現this真棒帖子,它解決了!基本上問題在於RVM。所以,我的問題已經解決,對於那些可能遭受同樣事情的人來說,請點擊鏈接!

回答

2

你的錯誤看起來像你缺少libpq-dev

您要在系統上先安裝Postgres的?

試試這個:

sudo apt-get install postgresql postgresql-client postgresql-server-dev-all libpq-dev 

接下來,你可以安裝PG寶石爲根?

sudo su - root 
gem install pg 
+0

嗨喬爾。感謝你及時的答覆。 今天我只有時間看這個,但它沒有工作:(它仍然抱怨告訴它無法找到Postgresql客戶端庫:| 我試圖做你在另一臺機器上所說的與一個32位版本的Ubuntu並且一切正常,它可以與它有關嗎? –