Tuesday, October 12, 2021

Re: question about libreadline

Luca Ferrari <fluca1978@gmail.com> writes:

> Hi all,
> this could be trivial, but I have a doubt about libreadline.
> In short: I've a program (pspg) that is crashing, and after inspecting
> the core I found in the backtrace a reference to libreadline. The
> program has been linked to libreadline 4, but in the system readline 7
> is installed.
> My doubt is that I'm messing around with numbers, and I'm unable to
> find the package for libreadline. The application is a PostgreSQL
> pager (<https://github.com/okbob/pspg>) that is not already in the
> ports.
> Also note, in the gdb output, there is a problem with ld symbols,
> could it be related?
> What am I missing here?
>
> Thanks,
> Luca
>
> puffy$ uname -sr
> OpenBSD 6.9
> puffy$ ldd $(which pspg)
> /usr/local/bin/pspg:
> Start End Type Open Ref GrpRef Name
> 00000bfbf0bb6000 00000bfbf0c03000 exe 1 0 0
> /usr/local/bin/pspg
> 00000bfed823a000 00000bfed826a000 rlib 0 2 0
> /usr/lib/libm.so.10.1
> 00000bfe67167000 00000bfe671a8000 rlib 0 1 0
> /usr/lib/libreadline.so.4.0

`pspg' is linked against system' libreadline so...

> 00000bfec62e9000 00000bfec62ef000 rlib 0 1 0
>[...]
> puffy$ pkg_info | grep readline
> readline-7.0p0 library to edit command lines as they are typed in

readline from ports shouldn't be needed. Moreover, port's readline
install files as `libereadline', so it should be difficult to pick those
header by accident.

> puffy$ gdb $(which pspg) pspg.core

gdb in base is pretty old. Install the `gdb' package which provides
`egdb' (a more up-to-date gdb) or use lldb from base. So, either

# pkg_add gdb
$ egdb $(which pspg) pspg.core

or

$ lldb --core pspg.core $(which pspg)

and then try to get a backtrace again

HTH

>[...]
> Dwarf Error: wrong version in compilation unit header (is 4, should
> be 2) [in module /usr/libexec/ld.so]
> #0 0x0000000000000000 in ?? ()
> (gdb) bt
> #0 0x0000000000000000 in ?? ()
> #1 0x00000bacf99001b6 in rl_callback_handler_install
> (prompt=Variable "prompt" is not available.
> ) at /usr/src/gnu/lib/libreadline/callback.c:75
> #2 0x00000baa60b446b4 in get_string (prompt=0xbaa60b13c53 "/",
> buffer=0x7f7ffffeed10 "\t", maxsize=255, defstr=0xbaa60b57860 "",
> _tabcomplete_mode=Variable "_tabcomplete_mode" is not available.
> ) at src/readline.c:588
> #3 0x00000baa60b352d8 in main (argc=0, argv=0x1) at src/pspg.c:5405

No comments:

Post a Comment