2017-04-25 102 views
1

Centos的6.9 (类似的问题:Can't find the PostgreSQL client library (libpq)但一个是在MacOS不Centos的,所以这些解决方案没有奏效PG创业板安装失败

红宝石2.1.8(试过2.2)

轨4.2。 6(试过5.0)

的Postgres 9.3

我试图与安装PG宝石:

gem install pg -- --with-pqlib=/usr/lib64/libpqxx-4.0.so --with-pg-config=/usr/pgsql-9.3/bin/pg_config 

我一直试图给它提供不同的库,但它卡住的是一些PQconnectdb()函数。下面的错误

Rails曾经被安装在这台电脑上与pg,但更新后发生的事情..任何想法在这里?

ERROR: Error installing pg: 
ERROR: Failed to build gem native extension. 

current directory: /home/myusername/.rvm/gems/ruby-2.1.8/gems/pg-0.14.1/ext 
/home/myusername/.rvm/rubies/ruby-2.1.8/bin/ruby -r ./siteconf20170425-12873-191077o.rb extconf.rb --with-pqlib=/usr/lib64/libpqxx-4.0.so --with-pg-config=/usr/pgsql-9.3/bin/pg_config 
Using config values from /usr/pgsql-9.3/bin/pg_config 
extconf.rb:34: warning: Insecure world writable dir /opt/anaconda in PATH, mode 040777 
checking for libpq-fe.h... yes 
checking for libpq/libpq-fs.h... yes 
checking for pg_config_manual.h... yes 
checking for PQconnectdb() in -l/usr/lib64/libpqxx-4.0.so... 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. 

安装PG库:Installed Packages postgresql93.x86_64 9.3.16-1PGDG.rhel6
postgresql93-contrib.x86_64 9.3.16-1PGDG.rhel6
postgresql93-debuginfo.x86_64 9.3.16-1PGDG.rhel6
postgresql93-devel.x86_64 9.3.16-1PGDG.rhel6
postgresql93-docs.x86_64 9.3.16-1PGDG.rhel6
postgresql93-libs.x86_64 9.3.16-1PGDG.rhel6
postgresql93-odbc.x86_64 09.06.0100-1PGDG.rhel6
postgresql93-odbc-debuginfo.x86_64 09.03.0400-1PGDG.rhel6
postgresql93-plperl.x86_64 9.3.16-1PGDG.rhel6
postgresql93-plpython.x86_64 9.3.16-1PGDG.rhel6
postgresql93-pltcl.x86_64 9.3.16-1PGDG.rhel6
postgresql93-server.x86_64 9.3.16-1PGDG.rhel6
postgresql93-tcl.x86_64 2.1.1-1.rhel6
postgresql93-tcl-debuginfo.x86_64 2.1.1-1.rhel6
postgresql93-test.x86_64 9.3.16-1PGDG.rhel6

+0

PostgreSQL的库? – mahatmanich

+0

http://stackoverflow.com/questions/6209797/cant-find-the-postgresql-client-library-libpq类似的问题在这里 – mahatmanich

+2

可能重复的[无法找到PostgreSQL客户端库(libpq)](http:/ /stackoverflow.com/questions/6209797/cant-find-the-postgresql-client-library-libpq) – mahatmanich

回答

1

我有一个linux brew包管理器,它有一些与pg gem install相关的旧依赖项。

答案是:

  • 移除[linux的泡制] [1]

    [1]:http://linuxbrew.sh/

  • 卸载红宝石RVM
  • 内爆RVM
  • 重新安装RVM
  • 重新安装ruby
  • 与皮克配置选项安装PG宝石:安装

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

+1

你应该试试rbenv :-)让生活变得更轻松... – mahatmanich

+0

好的呼叫,我会去下一步 – HoosierCoder

1

你试过吗?

$ sudo su 
$ env ARCHFLAGS="-arch x86_64" gem install pg 
+0

是的,那个抛出'检查libpq-fe.h ... *** extconf.rb失败***'错误,甚至如果我使用:'--with-pg-config =/usr/pgsql-9.3/bin/pg_config' – HoosierCoder