283
65我正在尝试为Ruby安装PostgreSQL的pg gem。
我发出了以下命令:
gem install pg
I installed Ruby 1.9.2 using RVM.
The above command shows me the following error.
The error is :
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 ***
等...
有人为Ubuntu用户提供了解决方案。那OpenSUSE Linux呢?
感谢前进。
根据我的搜索,OpenSUSE linux没有Postgres客户端的软件包,但是正如您已经安装的软件包一样,这意味着系统中存在pgsql.so
文件。您是如何安装它的,我可以看到以下内容,它也将安装开发库和客户端。
sudo zypper in postgresql postgresql-server postgresql-contrib
sudo zypper in postgresql-plperl postgresql-plpython postgresql-plctl
如果不起作用,请尝试在postgres安装路径中搜索该文件,locate file_name
很容易在其他linux上找到文件,但不确定在openSUSE中它是否是mlocate
软件包的一部分。如果找到该文件,则根据错误将其链接,错误正在搜索该文件。
如果仍然无法使用,则可以在环境变量中使用Postgres目录,并尝试单独安装gem。要获取postgres配置,请使用以下命令查看目录。
pg_config
现在尝试安装gem
PATH=$PATH:/Library/PostgreSQL/9.0/bin sudo gem install pg
在某些系统上,以下命令也可以解决问题,因此您也可以尝试一下
sudo gem install pg – --with-pg-config=/usr/local/pgsql/bin/pg_config