如何在 Ubuntu 上安装 PostgreSQL 的 pg gem? [英] How to install PostgreSQL's pg gem on Ubuntu?

查看:33
本文介绍了如何在 Ubuntu 上安装 PostgreSQL 的 pg gem?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为 Ruby 安装 PostgreSQL 的 pg gem.

I'm trying to install PostgreSQL's pg gem for Ruby.

我发出了以下命令:

gem install pg

我使用 RVM 安装了 Ruby 1.9.2.

I installed Ruby 1.9.2 using RVM.

上面的命令显示了以下错误.

The above command shows me the following error.

错误是:

Building native extensions.  This could take a while...

ERROR:  Error installing pg:

ERROR: Failed to build gem native extension.

/home/User/.rvm/rubies/ruby-1.9.2-preview3/bin/ruby extconf.rb

checking for pg_config... yes
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)

*** 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=/home/User/.rvm/rubies/ruby-1.9.2-preview3/bin/ruby
 --with-pg
 --without-pg
 --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
 --enable-static-build
 --disable-static-build
 --with-pqlib
 --without-pqlib
 --with-libpqlib
 --without-libpqlib
 --with-ms/libpqlib
 --without-ms/libpqlib

Gem files will remain installed in /home/user/.rvm/gems/ruby-1.9.2-preview3/gems/pg-0.9.0 for inspection.

Results logged to /home/user/.rvm/gems/ruby-1.9.2-preview3/gems/pg-0.9.0/ext/gem_make.out

我不知道是什么错误...

I don't know what is the error...

推荐答案

您需要安装带有PostgreSQL头文件的postgreSQL开发包

You need install the postgreSQL dev package with header of PostgreSQL

sudo apt-get install libpq-dev

这篇关于如何在 Ubuntu 上安装 PostgreSQL 的 pg gem?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆