Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error--can't find libpq.so.5 #5

Closed
rossj-cargotel opened this issue Aug 22, 2015 · 2 comments
Closed

Compilation error--can't find libpq.so.5 #5

rossj-cargotel opened this issue Aug 22, 2015 · 2 comments

Comments

@rossj-cargotel
Copy link

Having trouble building from source--make can't find libpq.so.5, even though it is right where pg_config says it is.

Any ideas?

Thanks,
Jeff

[root@717311-app1 pg_bulkload-3.1.8]# which pg_config
/usr/pgsql-9.4/bin/pg_config

[root@717311-app1 pg_bulkload-3.1.8]# pg_config
BINDIR = /usr/pgsql-9.4/bin
DOCDIR = /usr/share/doc/postgresql
HTMLDIR = /usr/share/doc/postgresql
INCLUDEDIR = /usr/pgsql-9.4/include
PKGINCLUDEDIR = /usr/pgsql-9.4/include
INCLUDEDIR-SERVER = /usr/pgsql-9.4/include/server
LIBDIR = /usr/pgsql-9.4/lib
PKGLIBDIR = /usr/pgsql-9.4/lib
LOCALEDIR = /usr/pgsql-9.4/share/locale
MANDIR = /usr/pgsql-9.4/share/man
SHAREDIR = /usr/pgsql-9.4/share
SYSCONFDIR = /etc/sysconfig/pgsql
PGXS = /usr/pgsql-9.4/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--disable-rpath' '--prefix=/usr/pgsql-9.4' '--includedir=/usr/pgsql-9.4/include' '--mandir=/usr/pgsql-9.4/share/man' '--datadir=/usr/pgsql-9.4/share' '--with-perl' '--with-python' '--with-tcl' '--with-tclconfig=/usr/lib64' '--with-gssapi' '--with-openssl' '--with-pam' '--with-includes=/usr/include' '--with-libraries=/usr/lib64' '--enable-nls' '--with-uuid=e2fs' '--with-libxml' '--with-libxslt' '--with-ldap' '--with-system-tzdata=/usr/share/zoneinfo' '--sysconfdir=/etc/sysconfig/pgsql' '--docdir=/usr/share/doc' '--with-zlib'
CC = gcc
CPPFLAGS = -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2
CFLAGS_SL = -fpic
LDFLAGS = -L../../../src/common -L/usr/lib64 -Wl,--as-needed
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -lxslt -lxml2 -lpam -lssl -lcrypto -lgssapi_krb5 -lz -lreadline -lrt -lcrypt -ldl -lm
VERSION = PostgreSQL 9.4.4

[root@717311-app1 pg_bulkload-3.1.8]# ls -al /usr/pgsql-9.4/lib/libpq.so.5
lrwxrwxrwx 1 root root 12 Aug 20 17:39 /usr/pgsql-9.4/lib/libpq.so.5 -> libpq.so.5.7

[root@717311-app1 pg_bulkload-3.1.8]# make clean
make[1]: Entering directory `/root/pg_bulkload-3.1.8/bin'
rm -f sql/load_function.sql sql/load_filter.sql
rm -f sql/init.sql sql/init-{8.3,8.4,9.0,9.1,9.2,9.3,9.4}.sql
rm -f pg_bulkload
rm -f pg_bulkload.o recovery.o pgut/pgut.o pgut/pgut-fe.o pgut/pgut-list.o
rm -rf results/ regression.diffs regression.out tmp_check/ log/
make[1]: Leaving directory `/root/pg_bulkload-3.1.8/bin'
make[1]: Entering directory `/root/pg_bulkload-3.1.8/lib'
rm -f nbtsort.c
rm -f pg_bulkload.so   libpg_bulkload.a  libpg_bulkload.pc
rm -f pg_bulkload.sql
rm -f binary.o logger.o parser_binary.o parser_csv.o parser_function.o parser_tuple.o pg_btree.o pg_bulkload.o pg_strutil.o reader.o source.o writer.o writer_binary.o writer_buffered.o writer_direct.o writer_parallel.o pgut/pgut-be.o pgut/pgut-ipc.o
make[1]: Leaving directory `/root/pg_bulkload-3.1.8/lib'
make[1]: Entering directory `/root/pg_bulkload-3.1.8/util'
rm -f pg_timestamp.so   libpg_timestamp.a  libpg_timestamp.pc
rm -f pg_timestamp.sql
rm -f pg_timestamp.o
make[1]: Leaving directory `/root/pg_bulkload-3.1.8/util'

[root@717311-app1 pg_bulkload-3.1.8]# make
make[1]: Entering directory `/root/pg_bulkload-3.1.8/bin'
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o pg_bulkload.o pg_bulkload.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o recovery.o recovery.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o pgut/pgut.o pgut/pgut.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o pgut/pgut-fe.o pgut/pgut-fe.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o pgut/pgut-list.o pgut/pgut-list.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 pg_bulkload.o recovery.o pgut/pgut.o pgut/pgut-fe.o pgut/pgut-list.o -L/usr/pgsql-9.4/lib -lpq -L/usr/pgsql-9.4/lib -L/usr/lib64 -Wl,--as-needed  -lpgcommon -lpgport -lpam -lssl -lcrypto -lgssapi_krb5 -lz -lreadline -lrt -lcrypt -ldl -lm -o pg_bulkload
make[1]: Leaving directory `/root/pg_bulkload-3.1.8/bin'
make[1]: Entering directory `/root/pg_bulkload-3.1.8/lib'
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fpic -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o binary.o binary.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fpic -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o logger.o logger.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fpic -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o parser_binary.o parser_binary.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fpic -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o parser_csv.o parser_csv.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fpic -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o parser_function.o parser_function.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fpic -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o parser_tuple.o parser_tuple.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fpic -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o pg_btree.o pg_btree.c
nbtree/nbtsort-9.4.c:178: warning: ‘unused_bt_spooldestroy’ defined but not used
nbtree/nbtsort-9.4.c:188: warning: ‘unused_bt_spool’ defined but not used
nbtree/nbtsort-9.4.c:198: warning: ‘unused_bt_leafbuild’ defined but not used
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fpic -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o pg_bulkload.o pg_bulkload.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fpic -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o pg_strutil.o pg_strutil.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fpic -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o reader.o reader.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fpic -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o source.o source.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fpic -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o writer.o writer.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fpic -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o writer_binary.o writer_binary.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fpic -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o writer_buffered.o writer_buffered.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fpic -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o writer_direct.o writer_direct.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fpic -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o writer_parallel.o writer_parallel.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fpic -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o pgut/pgut-be.o pgut/pgut-be.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fpic -I../include -I/usr/pgsql-9.4/include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o pgut/pgut-ipc.o pgut/pgut-ipc.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fpic -shared -o pg_bulkload.so binary.o logger.o parser_binary.o parser_csv.o parser_function.o parser_tuple.o pg_btree.o pg_bulkload.o pg_strutil.o reader.o source.o writer.o writer_binary.o writer_buffered.o writer_direct.o writer_parallel.o pgut/pgut-be.o pgut/pgut-ipc.o -L/usr/pgsql-9.4/lib -L/usr/lib64 -Wl,--as-needed  -L/usr/pgsql-9.4/lib -lpq
sed 's,MODULE_PATHNAME,$libdir/pg_bulkload,g' pg_bulkload.sql.in >pg_bulkload.sql
make[1]: Leaving directory `/root/pg_bulkload-3.1.8/lib'
make[1]: Entering directory `/root/pg_bulkload-3.1.8/util'
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fpic -I../include -I. -I./ -I/usr/pgsql-9.4/include/server -I/usr/pgsql-9.4/include/internal -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include  -c -o pg_timestamp.o pg_timestamp.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -O2 -fpic -shared -o pg_timestamp.so pg_timestamp.o -L/usr/pgsql-9.4/lib -L/usr/lib64 -Wl,--as-needed
sed 's,MODULE_PATHNAME,$libdir/pg_timestamp,g' pg_timestamp.sql.in >pg_timestamp.sql
make[1]: Leaving directory `/root/pg_bulkload-3.1.8/util'

[root@717311-app1 pg_bulkload-3.1.8]# ldd bin/pg_bulkload
    linux-vdso.so.1 =>  (0x00007ffcf5db2000)
    libpq.so.5 => not found
    libc.so.6 => /lib64/libc.so.6 (0x00000030a5a00000)
    /lib64/ld-linux-x86-64.so.2 (0x00000030a5200000)
[root@717311-app1 pg_bulkload-3.1.8]#

[root@717311-app1 pg_bulkload-3.1.8]# bin/pg_bulkload
bin/pg_bulkload: error while loading shared libraries: libpq.so.5: cannot open shared object file: No such file or directory
[root@717311-app1 pg_bulkload-3.1.8]#


@bwtakacy
Copy link
Collaborator

It seems that the shared library of PostgreSQL is not recognized in your environment.

I guess the OS is RHEL or RHEL like linux and PostgreSQL is installed by rpms.
If so, could you check the below commands?

# ls -l /etc/ld.so.conf.d/
...
lrwxrwxrwx. 1 root root  31  8月 23 21:10 postgresql-pgdg-libs.conf -> /etc/alternatives/pgsql-ld-conf
...
# cat /etc/ld.so.conf.d/postgresql-pgdg-libs.conf
/usr/pgsql-9.4/lib/
# alternatives --display pgsql-ld-conf
pgsql-ld-conf - status is auto.
 link currently points to /usr/pgsql-9.4/share/postgresql-9.4-libs.conf
/usr/pgsql-9.4/share/postgresql-9.4-libs.conf - priority 940
Current `best' version is /usr/pgsql-9.4/share/postgresql-9.4-libs.conf.

If above output is not shown in your environment, try to remove postgresql94-libs package and re-install it.

Regards,

@rossj-cargotel
Copy link
Author

That did the trick! Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants