:: Re: [DNG] Managing shared libraries
Startseite
Nachricht löschen
Nachricht beantworten
Autor: Joel Roth
Datum:  
To: dng
Neue Treads: [DNG] ..a solution, was: Managing shared libraries
Betreff: Re: [DNG] Managing shared libraries
On Sun, Oct 08, 2023 at 03:00:51AM +0200, Arnt Karlsen wrote:
> On Sat, 7 Oct 2023 08:29:56 -1000, Joel wrote in message
> <20231007182956.tkekgynvgmhvnxwg@sprite>:
>
> > On Sat, Oct 07, 2023 at 08:02:37PM +0300, Boian Bonev via Dng wrote:
> > > 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...
> >
> > Hi Boian and others, many thanks for the informative replies,
> >
> > I've found a solution that doesn't require an older readline.
>
> .._what_ "solution that doesn't require an older readline" did you find?
>
> ..a simple pointer might be helpful to the next guy or gal searching
> this list for a solution that doesn't require an older readline.
> Prepending "Solved this way" onto the "Re: [DNG] Managing shared
> libraries" Subject: line, might also help people find your solution,
> which might be the right solution for their problen. Or not. This
> whole thread and your found solution should help them figure that out.


I didn't think it would be interesting to folks here, but
since you ask: I was using a second library, libtermkit, to
handle some of the key mappings and the two weren't playing
together: I couldn't re-initialize readline after having
unloaded libtermkey. Instead I found I can use readline to
bind perl functions to the arrow keys. For example, to bind
$coderef (a reference to a function) to the right arrow key.

$term->add_defun($func_name, $coderef);
$term->bind_keyseq("\\e]C",$func_name)

> > happy hacking to all! and to all a good night!




--
Joel Roth