Thread: linking with readline

linking with readline

From
"PC Drew"
Date:
I did the usual ./configure; make; make install and everything worked like a
charm.  I continued to install the way the INSTALL file said and went to
connect to the database using psql and here's what happened:

[big:~] > ./psql www
Welcome to psql, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit

/usr/libexec/ld.so: Undefined symbol "_tgetent" called from
psql:/usr/lib/libreadline.so.4.2 at 0x40089934

I tried upgrading the stock version of libreadline on OpenBSD to the latest
version, recompiled PostgreSQL and the same thing happened.

After doing a little research, I found that tgetent is in the termcap
library.  When I added -ltermcap to the following line in
src/Makefile.global:

LIBS = -lz -lresolv -lcompat -lm -lutil -ltermcap -lreadline

then recompiled psql, here's what happend:

[big:~/postgresql-7.1.3/src/bin/psql] > ./psql www
Welcome to psql, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit

www=#

and ldd shows:

[big:~/postgresql-7.1.3/src/bin/psql] > ldd psql
psql:
        -lpq.2 => /usr/local/pgsql/lib/libpq.so.2.1 (0x40034000)
        -lz.1 => /usr/lib/libz.so.1.3 (0x40041000)
        -lm.0 => /usr/lib/libm.so.0.1 (0x4004d000)
        -lutil.6 => /usr/lib/libutil.so.6.0 (0x40061000)
        -ltermcap.8 => /usr/lib/libtermcap.so.8.0 (0x4006b000)
        -lreadline.4 => /usr/lib/libreadline.so.4.2 (0x400aa000)
        -lc.26 => /usr/lib/libc.so.26.2 (0x400cd000)

I don't know if this will help or if it's a legitimate bug, but it works for
me!

--
PC Drew

Superior Communications
1455 Dixon Ave, Suite 310
Lafayette, CO 80026

Phone: (720) 841-4543
Email: pc@superiorcomm.net

Re: linking with readline

From
Peter Eisentraut
Date:
PC Drew writes:

> /usr/libexec/ld.so: Undefined symbol "_tgetent" called from
> psql:/usr/lib/libreadline.so.4.2 at 0x40089934

The OpenBSD linker is broken.

> After doing a little research, I found that tgetent is in the termcap
> library.  When I added -ltermcap to the following line in
> src/Makefile.global:
>
> LIBS = -lz -lresolv -lcompat -lm -lutil -ltermcap -lreadline

That's a good fix.

The current CVS tip also works around this problem.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter