Re: Dynamic loading of libreadline opens wrong library filename

"'Yao Zi' via lua-l" <[email protected]>
Newsgroups gmane.comp.lang.lua.general
Message-ID <aamhSPqOjDcwdq-e@pie>
On Thu, Mar 05, 2026 at 06:14:25AM -0800, Ross Burton wrote:
> Hi,
> 
> As of lua 5.5[1] libreadline is no longer linked to at build time but 
> instead dlopen()'d.  However, the library that is dlopen'd out of the box 
> on Linux is "libreadline.so":
> 
>  #if defined(LUA_USE_LINUX)
>  #define LUA_USE_POSIX
>  #define LUA_USE_DLOPEN         /* needs an extra library: -ldl */
> +#define LUA_READLINELIB                "libreadline.so"
>  #endif
> 
> This filename will only be available on systems where readline was compiled 
> by the user, where the readline development package has been installed. 
>  For example, it will only be available on Debian systems where 
> libreadline-dev has been installed[2], as the actual library is 
> libreadline.so.8.2 (with a symlink of libreadline.so.8) [3].
> 
> Also, if readline changes API and switches to libreadline.so.9 then you 
> might well be using the wrong API, causing crashes.
> 
> I think lua should be explicitly loading libreadline.so.8, this will work 
> for everyone and be sure that you get a library with the ABI that you 
> expect.

Natanael has raised this before[4]. As a distro maintainer, I'll second
the idea, too.

> Cheers,
> Ross

Regards,
Yao Zi

> [1] https://github.com/lua/lua/commit/366c85564874d560b3608349f752e9e490f9002d
> [2] https://packages.debian.org/trixie/amd64/libreadline-dev/filelist
> [3] https://packages.debian.org/trixie/amd64/libreadline8t64/filelist

[4]: https://groups.google.com/g/lua-l/c/yws8Wmgjcl0/m/LvTmtu2-DAAJ

-- 
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/aamhSPqOjDcwdq-e%40pie.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.