:: Re: [DNG] Managing shared libraries
Góra strony
Delete this message
Reply to this message
Autor: Boian Bonev
Data:  
Dla: aitor, dng
Temat: Re: [DNG] Managing shared libraries
Hi,

On Thu, 2023-10-05 at 00:06 +0200, aitor wrote:
> Hi Joel,
> On 4/10/23 3:06, Joel Roth via Dng wrote:
> A likely way forward is to place the 6.3
> sources in /usr/include/readline and compile
> against that.
> You can define a separate pkgconfig file for 6.3, say "readline6.pc", as follows:
>
> prefix=/usr
> exec_prefix=${prefix}
> libdir=${prefix}/lib
> includedir=<put_here_the_path_you_want>
>
> Name: Readline
> Description: Gnu Readline library for command line editing
> URL: http://tiswww.cwru.edu/php/chet/readline/rltop.html
> Version: 6.3
> Requires.private: tinfo
> Libs: -L${libdir} -lreadline
> Cflags: -I${includedir}
>
> Note that I've also moved the path to the shared library from "/usr/lib/x86_64-linux-gnu"
> to "/usr/lib". Obviously, you need to create the symlinks at "/usr/lib" for 6.3.
>
> In doing so, both versions 6.3 and 8.2 can coexist.
> Now, to link against version 6.3:
> `pkg-config --cflags --libs readline6`
>
> I would also like to compile against 8.1, but can I (and do
> I need to) point the symlink at 8.1 without breaking things
> like bash that depend on version 8.2?
> I don't think it would break bash. But this is a guess. Either way, you can always use LD_PRELOAD.
> For example:
> $ LD_PRELOAD=/lib/x86_64-linux-gnu/libreadline.so.8
> Cheers,
> Aitor.


That will not work - -lreadline will use /usr/lib/ARCH/libreadline.so
which is a symlink that comes from the -dev package and is always
pointing to the latest version. The older versions of the shared
library provide only /usr/lib/ARCH/libreadline.so.VER for not breaking
old programs that were linked to an older version of the library.

Manually changing the link is OK - that will not break anything.

The proper way to compile against an older version is to install the
respective -dev package (that will conflict with all newer/older -dev
packages).

A side suggestion to the OP is to check libedit or linenoise, maybe
they already have some perl bindings...

With best regards,
b.