On 2021-10-12, Luca Ferrari <fluca1...@gmail.com> wrote:
> 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.

What you refer to as "libreadline 4" is editline's readline emulation
which is in the base OS. GNU libreadline is also available (in packages
not the base OS), your ldd output shows you aren't linking against that
(to avoid the conflict the libraries for this have an 'e' prefix, names
like "libereadline").

You probably need to patch the build system to use the ereadline library
and the correct headers (-I/usr/local/include/ereadline).

> Also note, in the gdb output, there is a problem with ld symbols,
> could it be related?

The version of gdb in base does not work properly with modern compilers.
pkg_add gdb and use the "egdb" binary instead.

> 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
>        00000bfec62e9000 00000bfec62ef000 rlib  0    1   0
> /usr/lib/libpanel.so.6.0
>        00000bfe1451d000 00000bfe1457e000 rlib  0    2   0
> /usr/lib/libcurses.so.14.0
>        00000bfe1a873000 00000bfe1a8c8000 rlib  0    1   0
> /usr/local/lib/libpq.so.6.12
>        00000bfeba135000 00000bfeba229000 rlib  0    2   0
> /usr/lib/libc.so.96.0
>        00000bfe9fab5000 00000bfe9fb21000 rlib  0    1   0
> /usr/lib/libssl.so.48.2
>        00000bfe05c62000 00000bfe05e9d000 rlib  0    2   0
> /usr/lib/libcrypto.so.46.2
>        00000bfeb21d8000 00000bfeb21d8000 ld.so 0    1   0
> /usr/libexec/ld.so
> puffy$ ls -l /usr/lib/*readline*
> -r--r--r--  1 root  bin  1092672 Apr 19 18:17 /usr/lib/libreadline.a
> -r--r--r--  1 root  bin   603792 Apr 19 18:17 /usr/lib/libreadline.so.4.0
> -r--r--r--  1 root  bin   977902 Apr 19 18:17 /usr/lib/libreadline_p.a
> puffy$ pkg_info | grep readline
> readline-7.0p0      library to edit command lines as they are typed in
>
>
>
> puffy$ gdb $(which pspg) pspg.core
>  GNU gdb 6.3
>  Copyright 2004 Free Software Foundation, Inc.
>  GDB is free software, covered by the GNU General Public License, and you are
>  welcome to change it and/or distribute copies of it under certain conditions.
>  Type "show copying" to see the conditions.
>  There is absolutely no warranty for GDB.  Type "show warranty" for details.
>  This GDB was configured as "amd64-unknown-openbsd6.9"...
>  Core was generated by `pspg'.
>  Program terminated with signal 11, Segmentation fault.
>  Loaded symbols for /usr/local/bin/pspg
>  Reading symbols from /usr/lib/libm.so.10.1...done.
>  Loaded symbols for /usr/lib/libm.so.10.1
>  Reading symbols from /usr/lib/libreadline.so.4.0...done.
>  Loaded symbols for /usr/lib/libreadline.so.4.0
>  Reading symbols from /usr/lib/libpanel.so.6.0...done.
>  Loaded symbols for /usr/lib/libpanel.so.6.0
>  Reading symbols from /usr/lib/libcurses.so.14.0...done.
>  Loaded symbols for /usr/lib/libcurses.so.14.0
>  Reading symbols from /usr/local/lib/libpq.so.6.12...done.
>  Loaded symbols for /usr/local/lib/libpq.so.6.12
>  Reading symbols from /usr/lib/libc.so.96.0...done.
>  Loaded symbols for /usr/lib/libc.so.96.0
>  Reading symbols from /usr/lib/libssl.so.48.2...done.
>  Loaded symbols for /usr/lib/libssl.so.48.2
>  Reading symbols from /usr/lib/libcrypto.so.46.2...done.
>  Loaded symbols for /usr/lib/libcrypto.so.46.2
>  Reading symbols from /usr/libexec/ld.so...Error while reading shared
> library symbols:
>  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
>
>


-- 
Please keep replies on the mailing list.

Reply via email to