Can't find the PostgreSQL client library (libpq)

Issue #195 invalid
Dmitrii Golub (Houdini)
created an issue

postgresql installed from source.

gem install pg -- --with-pg-config=/usr/local/pgsql/bin/pg_config
Building native extensions with: '--with-pg-config=/usr/local/pgsql/bin/pg_config'
This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

    /home/houdini/.rvm/rubies/ruby-2.1.5/bin/ruby -r ./siteconf20141125-21571-1jybmg5.rb extconf.rb --with-pg-config=/usr/local/pgsql/bin/pg_config
Using config values from /usr/local/pgsql/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.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)

different ruby installs, different postgresql versions.

houdini@houdini-bizon:~/codes/ruby-pg$ pg_config 
BINDIR = /usr/local/pgsql/bin
DOCDIR = /usr/local/pgsql/share/doc
HTMLDIR = /usr/local/pgsql/share/doc
INCLUDEDIR = /usr/local/pgsql/include
PKGINCLUDEDIR = /usr/local/pgsql/include
INCLUDEDIR-SERVER = /usr/local/pgsql/include/server
LIBDIR = /usr/local/pgsql/lib
PKGLIBDIR = /usr/local/pgsql/lib
LOCALEDIR = /usr/local/pgsql/share/locale
MANDIR = /usr/local/pgsql/share/man
SHAREDIR = /usr/local/pgsql/share
SYSCONFDIR = /usr/local/pgsql/etc
PGXS = /usr/local/pgsql/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = 
CC = gcc
CPPFLAGS = -D_GNU_SOURCE
CFLAGS = -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard
CFLAGS_SL = -fpic
LDFLAGS = -L../../../src/common -Wl,--as-needed -Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags
LDFLAGS_EX = 
LDFLAGS_SL = 
LIBS = -lpgcommon -lpgport -lz -lreadline -lrt -lcrypt -ldl -lm 
VERSION = PostgreSQL 9.4rc1

Comments (4)

  1. Dmitrii Golub (Houdini) reporter

    ok, I found the problem

    in /usr/local/pgsql/lib lrwxrwxrwx 1 root root 12 нояб. 25 17:16 libpq.so -> libpq.so.5.7 lrwxrwxrwx 1 root root 12 нояб. 25 17:16 libpq.so.5 -> libpq.so.5.7 -rwxr-xr-x 1 root root 186K нояб. 25 16:42 libpq.so.5.6 -rwxr-xr-x 1 root root 185K нояб. 25 17:16 libpq.so.5.7 -rwxr-xr-x 1 root root 190K сент. 15 14:46 libpq.so.5.8

    However in libpq.so.5.7 there is no function pg_sprintf, it's defined in libpq.so.5.8. So, after: sudo ln -sf libpq.so.5.8 libpq.so

    I could compile ruby-pg

    Thanks for help

  2. Log in to comment