Can't find the libpq-fe.h

作者: 云中布衣   分类:  操作系统    热度: (952℃)   时间: 2015-10-15 0:41   标签: #ruby  #gem  #rails    

Can't find the 'libpq-fe.h header when trying to install pg gem

报错详情:

billcode@billcode-y470:~/github/course/rottenpotatoes-rails-intro$ bundle install
Fetching source index from http://mirrors.aliyun.com/rubygems/
Resolving dependencies.....................
Using rake 10.4.2
Using ZenTest 4.11.0
……
Using multi_json 1.11.2
Using jbuilder 2.3.1
Using jquery-rails 4.0.4
Installing pg 0.18.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
    /home/billcode/.rvm/rubies/ruby-2.2.2/bin/ruby -r ./siteconf20151015-13282-1w5iynx.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/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
	……
	--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}/lib

extconf failed, exit code 1
Gem files will remain installed in /home/billcode/.rvm/gems/ruby-2.2.2/gems/pg-0.18.2 for inspection.
Results logged to /home/billcode/.rvm/gems/ruby-2.2.2/extensions/x86-linux/2.2.0/pg-0.18.2/gem_make.out
An error occurred while installing pg (0.18.2), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.2'` succeeds before bundling.

解决方法:

系统少东西了尝试先安装 libpq-dev,在运行bundle install :
  • for Ubuntu systems: sudo apt-get install libpq-dev
  • on RHEL systems: yum install postgresql-devel
  • for Mac: brew install postgresql

(完)

56.8K

发表评论:

© 云中布衣 2015 | Driven by EMLOG  | SiteMap | RunTime: 7.68ms&RSS  | MORE  |   | TOP

文章数量【258】 评论数量【238】 稳定运行【1211天】

Visitor IP Address【54.92.193.89】

Email:ieeflsyu#outlook.com