2012-11-07 80 views
4

我試圖安裝一個新的Rails應用程序的PG寶石,但我不斷收到同樣的錯誤:PG寶石與Ubuntu

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

     /home/arthur/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb --with-pg-lib=/usr/lib 
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. 

我已經嘗試了一切,從這個問題:How to install PostgreSQL's pg gem on Ubuntu? 但沒有什麼真的爲我工作。順便說一下,這是紅寶石1.9.2和Rails 3.2。

謝謝

+0

檢查此[鏈接] [1],希望它幫助。 [1]:http://stackoverflow.com/questions/6209797/cant-find-the-postgresql-client-library-libpq –

+0

請追加紅寶石和您的文章軌版本。 – tokhi

+0

您是否檢查過mkmf.log,因爲輸出建議?它說什麼? – davidrac

回答

1

安裝postgresql 9,然後安裝你的寶石。

sudo apt-get install postgresql libpq-dev 

現在,運行

gem install pg 

然後

捆綁安裝