pg gem 安装(postgresql94)

摘要:
使用下面命令安装报错geminstallpg错误:[root@AS-testmiddle_database]#geminstallpgBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingpg:ERROR:Failedtobuildgemnativeextension.currentdirectory:/usr/lo

使用下面命令安装报错

gem install pg

错误:

[root@AS-test middle_database]# gem install pg
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/pg-0.18.4/ext
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160413-9383-11d3dx6.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
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME)
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--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}/lib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/pg-0.18.4/mkmf.log
extconf failed, exit code 1

网上搜索了一大片,说是需要安装postgresql-devel这个rpm.

于是安装94版本的:

yum install http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-redhat94-9.4-1.noarch.rpm
yum install -y postgresql94-devel-9.4.6 #我主机postgresql 9.4.6的server已安装

然后再次执行上面的命令,还是报错,于是

gem install pg --with-pg-config=/usr/pgsql-9.4/bin/pg_config

接着报错:

ERROR: While executing gem ... (OptionParser::InvalidOption)
invalid option: --with-pg-config=/usr/pgsql-9.4/bin/pg_config

折腾许久,源来需要多加一个 --

gem install pg -- --with-pg-config=/usr/pgsql-9.4/bin/pg_config

免责声明:文章转载自《pg gem 安装(postgresql94)》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇安卓多线程的实现【js重学系列】作用域下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

sass笔记一(安装)

安装Sass和Compass sass基于Ruby语言开发而成,因此安装sass前需要安装Ruby。(注:mac下自带Ruby无需在安装Ruby!) window下安装SASS首先需要安装Ruby,先从官网下载Ruby并安装。安装过程中请注意勾选Add Ruby executables to your PATH添加到系统环境变量。如下图: 安装完成后需测...

CocoaPods版本升级

命令行更新(安装)步骤$ sudo gem update --system // 先更新gem,国内需要切换源$ gem sources --remove https://rubygems.org/$ gem sources -a https://ruby.taobao.org/$ gem sources -l*** CURRENT SOURCES ***...

Windows环境搭建Web自动化测试框架Watir

Windows环境搭建Web自动化测试框架Watir 一、前言     Web自动化测试一直是一个比较迫切的问题,对于现在web开发的敏捷开发,却没有相对应的敏捷测试,故开此主题,一边研究,一边将Web自动化测试应用于工作中,进而形成能够独立成章的博文,希望能够为国内web自动化测试的发展做一点绵薄的贡献吧,笑~ 二、Watir搭建流程...

sass学习笔记-安装

Sass安装(windows版) 在 Windows 平台下安装 Ruby 需要先有 Ruby 安装包,大家可以到 Ruby 的官网(http://rubyinstaller.org/downloads)下载对应需要的 Ruby 版本。 Ruby 安装文件下载好后,可以按应用软件安装步骤进行安装 Ruby。在安装过程中,个人建议将其安装在 C 盘下,在安...

CocoaPods安装和使用201712

CocoaPods安装使用详解 2017.12 首先,很有必要了解一下CocoaPods、Ruby和RubyGems,以及它们之间的关系。 CocoaPods是第三方库的辅助管理工具,依赖于Ruby。 Ruby是一种简捷的面向对象脚本语言。 RubyGems相当于Ruby的一个管理工具。 以下几个官网有必要看看, https://cocoapod...

mac cocoapod安装过程

cocoapod: 自动化管理第三方开发包的一个插件, 废话不多说, 一个新手只需做如下几个步骤 1-> 安装ruby环境(可忽略, 不是必要)  1.1 首先我们先看看当前你机器上ruby的版本 ruby -v ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16] 1.2 接下来我们来...