gem安裝pg遇到問題

來源:互聯網
上載者:User

標籤: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遇到問題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.