Thread: symbol lookup error: /usr/lib/9.6/bin/psql: undefined symbol: PQsetErrorContextVisibility

Hello all,
I have a problem with connecting database via psql;/usr/lib/9.6/bin/psql: symbol lookup error: /usr/lib/9.6/bin/psql: undefined symbol: PQsetErrorContextVisibility

OS :Debian GNU/Linux 9

I tried setting it didn't help; export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/postgresql/9.6/lib

Can anyone please help me?
On Fri, Jun  4, 2021 at 06:21:02PM -0400, rob stan wrote:
> Hello all,
> I have a problem with connecting database via psql;/usr/lib/9.6/bin/psql:
> symbol lookup error: /usr/lib/9.6/bin/psql: undefined symbol:
> PQsetErrorContextVisibility
> 
> OS :Debian GNU/Linux 9
> 
> I tried setting it didn't help; export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/
> lib/postgresql/9.6/lib
> 
> Can anyone please help me?

Uh, your binary is at /usr/lib/9.6/bin/psql but you are specifying the
LD path as /usr/lib/postgresql/9.6/lib.  Maybe try:

    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/9.6/lib

The problem is clearly using the wrong version of the libpq libary.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  If only the physical world exists, free will is an illusion.




On 6/4/21 5:21 PM, rob stan wrote:
Hello all,
I have a problem with connecting database via psql;/usr/lib/9.6/bin/psql: symbol lookup error: /usr/lib/9.6/bin/psql: undefined symbol: PQsetErrorContextVisibility
OS :Debian GNU/Linux 9
I tried setting it didn't help; export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/postgresql/9.6/lib
Can anyone please help me?

How did you install Postgresql?  If by the package manager, what packages did you install?

--
Angular momentum makes the world go 'round.
rob stan <aslicokay@gmail.com> writes:
> I have a problem with connecting database via psql;/usr/lib/9.6/bin/psql:
> symbol lookup error: /usr/lib/9.6/bin/psql: undefined symbol:
> PQsetErrorContextVisibility

Apparently psql is linking to a pre-9.6 copy of libpq.so.  You could
confirm that with
    ldd /usr/lib/9.6/bin/psql

> I tried setting it didn't help; export
> LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/postgresql/9.6/lib

(1) Are you sure there's a more up-to-date libpq.so there?
    That path doesn't seem to square with where you say psql is.

(2) Possibly you need to put the 9.6 directory first not last.

(3) If that still doesn't work, you need to configure the system's
    dynamic linker to look there.  You really want to do that anyway,
    as messing with LD_LIBRARY_PATH all the time is no fun.
    See "man ldconfig".

            regards, tom lane



Hi Tom ;

Thank you for your detailed email.

rob stan <aslicokay@gmail.com> writes:
> I have a problem with connecting database via psql;/usr/lib/9.6/bin/psql:
> symbol lookup error: /usr/lib/9.6/bin/psql: undefined symbol:
> PQsetErrorContextVisibility

Apparently psql is linking to a pre-9.6 copy of libpq.so.  You could
confirm that with
        ldd /usr/lib/9.6/bin/psql

You're absolutely right i have bad linking for it to old version 9.5 in the same node.
Here they are ; 

        linux-vdso.so.1 (0x00007ffc4594e000)
        libpq.so.5 => /usr/lib/postgresql/9.5/lib/libpq.so.5 (0x00007fe79f2c2000)
        libedit.so.2 => /usr/lib/x86_64-linux-gnu/libedit.so.2 (0x00007fe79f08a000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe79ed86000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe79e9e7000)
        libssl.so.1.1 => /usr/lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007fe79e77b000)
        libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007fe79e2e0000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe79e0c3000)
        libncurses.so.5 => /lib/x86_64-linux-gnu/libncurses.so.5 (0x00007fe79dea0000)
        libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007fe79dc76000)
        libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007fe79da61000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fe79f77f000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe79d85d000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fe79d655000)

> I tried setting it didn't help; export
> LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/postgresql/9.6/lib

(1) Are you sure there's a more up-to-date libpq.so there?
    That path doesn't seem to square with where you say psql is.

(2) Possibly you need to put the 9.6 directory first not last.
You mean linking like 9.5 as below right ? 

 libpq.so.5 => /usr/lib/postgresql/9.5/lib/libpq.so.5 (will add version 9.6 link ,too if i got it right)

(3) If that still doesn't work, you need to configure the system's
    dynamic linker to look there.  You really want to do that anyway,
    as messing with LD_LIBRARY_PATH all the time is no fun.
    See "man ldconfig".

I tried but i think i missed something.

Appreciate it. 

Tom Lane <tgl@sss.pgh.pa.us>, 4 Haz 2021 Cum, 18:44 tarihinde şunu yazdı:
rob stan <aslicokay@gmail.com> writes:
> I have a problem with connecting database via psql;/usr/lib/9.6/bin/psql:
> symbol lookup error: /usr/lib/9.6/bin/psql: undefined symbol:
> PQsetErrorContextVisibility

Apparently psql is linking to a pre-9.6 copy of libpq.so.  You could
confirm that with
        ldd /usr/lib/9.6/bin/psql

> I tried setting it didn't help; export
> LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/postgresql/9.6/lib

(1) Are you sure there's a more up-to-date libpq.so there?
    That path doesn't seem to square with where you say psql is.

(2) Possibly you need to put the 9.6 directory first not last.

(3) If that still doesn't work, you need to configure the system's
    dynamic linker to look there.  You really want to do that anyway,
    as messing with LD_LIBRARY_PATH all the time is no fun.
    See "man ldconfig".

                        regards, tom lane