2013-03-08 73 views
7

我想爲Ruby安裝pg(PostreSQL)gem。我收到此錯誤:pg gem install說版本太舊?

postgres/9.2-pgdg/bin/64/pg_config 
Using config values from /location/to/install/postgres/9.2-pgdg/bin/64/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... yes 
checking for PQconnectionUsedPassword()... no 
Your PostgreSQL is too old. Either install an older version of this gem or upgrade your  database. 
*** 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. 

PostgreSQL的版本:Postgres的(PostgreSQL的)9.2.3

OS:的Solaris 10

我也曾嘗試:

gem install pg -- --with-pgsql-lib=/location/of/install/postgres/9.2-pgdg/lib/64/ --with-pg-config=/location/of/install/postgres/9.2-pgdg/bin/64/pg_config 

我沒有想法爲什麼會發生此錯誤,並且我無法在Google上找到任何有用的信息。

任何幫助,非常感謝。

+0

我有多個版本,但我指向正確的版本也mkmf.log我看到了同樣的錯誤引用pQconnectionUsedPassword( )。 – arrowill12 2013-03-08 20:29:54

+2

您可能需要設置'PATH'來確保正確的'pg_config'可執行文件在PATH中處於第一位,並設置任何'LD_LIBRARY_PATH'或Solaris等效環境變量以確保找到正確的'libpq'。 – 2013-03-09 00:37:45

+0

「mkmf.log」在檢查「PQconnectionUsedPassword」存在的部分中說了些什麼? – 2013-03-09 15:06:17

回答

2

很多事情可能會出錯安裝數據庫客戶端,寶石和使用它。

我通常從源代碼安裝PostgreSQL,而不是從發行版安裝。在那一點上,我知道我有所有的來源,並確切知道事情的安裝位置。安裝與客戶端驅動程序交流的gem時,這一點很重要。

我還依賴從源代碼安裝Ruby,可以直接自己安裝,也可以通過使用rbenv或RVM(如果它位於我的開發框之一)來安裝。然後我也直接安裝pg gem,使用gem install pg;在安裝語言時,我有很多使用發行版的不好的經歷,所以我就此放棄了老生常談。

我寫了一個小腳本,我在我的Mac OS系統使用,我發現有用我的CentOS Linux機器:

 
#!/bin/sh -x 

PATH=/Library/PostgreSQL/9.2/bin:$PATH 
gem install pg 

我調整路徑除了取決於安裝得到了PostgreSQL的地方,它似乎有竅門。我已經使用了更長,更「全面」的選項,但這似乎也適用。

問題是安裝程序需要從pg_config可執行文件中挖出安裝信息,並能夠找到pg_config這樣做。

+0

每次都有作品。 – pzin 2015-01-10 10:23:32

0

我一直在堅持,直到我意識到postgresql-develpostgresql-libs分別來自8.1.23 !!!

$ yum list installed postgres* 
Loaded plugins: fastestmirror, security 
Installed Packages 
postgresql-devel.i386       8.1.23-10.el5_10      installed 
postgresql-devel.x86_64       8.1.23-10.el5_10      installed 
postgresql-libs.i386       8.1.23-10.el5_10      installed 
postgresql-libs.x86_64       8.1.23-10.el5_10      installed 

--------------- 

$ sudo yum install postgresql94-libs 
$ sudo yum install postgresql94-devel 

$ gem install pg 
Successfully installed pg-0.18.1 
0

安裝和連接和PostgreSQL自制固定對我來說:

brew install postgresql 
brew unlink postgresql91 
brew link --overwrite postgresql