標籤:io os ar for 檔案 資料 sp 問題 cti
gem安裝pg遇到問題
安裝pg遇到問題
#gem install pg
報錯資訊為:
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... no
Can‘t find the ‘libpq-fe.h header
*** 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}/lib64
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby
--with-pg
--without-pg
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/
Gem files will remain installed in /home/oss/.gem/ruby/gems/pg-0.17.1 for inspection.
Results logged to /home/oss/.gem/ruby/gems/pg-0.17.1/ext/gem_make.out
#=============================================================
說明:
注意看上邊的報錯資訊(如下邊這樣的語句):
checking for libpq-fe.h... no
Can‘t find the ‘libpq-fe.h header
你安裝其他gem外掛程式的時候也會遇到類似這樣的問題,找不到什麼什麼.h這樣的檔案,就是缺少你安裝的這個gem包的依賴包,一般都是安裝xxxx-devel就能解決問題。
例如我遇到的這個問題,安裝postgresql這個資料庫的依賴包就行了postgresql-devel,具體執行下面的命令即可
#===================================================================
解決方案:
安裝postgresql資料庫的依賴包
#yum install postgresql-devel
安裝好以後再安裝pg這個gem包
#gem install pg
OK,搞定
gem安裝pg遇到問題