On Mon, Nov 06, 2023 at 02:25:20PM +0100, [email protected] wrote: > It is pkglibdir. Would be easy to change Makefile.am to put them there, > but are we sure that the linker will find them when the dlopened *XS > files are loaded by perl?
The straightforward way of doing this seems to me to be to load the libraries with Texinfo::XSLoader. This is different to other uses of Texinfo:XSLoader, as the loaded libraries do not expose any Perl subroutines (XSUB's) to the perl code, but I expect that it should work. I'm trusting that dynamically loaded libraries can call into each other, although I'm not an expert on this. However, changing the installation directory may work: diff --git a/tp/Texinfo/XS/Makefile.am b/tp/Texinfo/XS/Makefile.am index fe9b05f9d6..20a95ac620 100644 --- a/tp/Texinfo/XS/Makefile.am +++ b/tp/Texinfo/XS/Makefile.am @@ -107,7 +107,7 @@ EXTRA_DIST += XSParagraph.xs MiscXS.xs # FIXME this is an internal library. Do not put it in lib? # it still needs to be found by the linker. if HAVE_ICONV -lib_LTLIBRARIES = libtexinfo.la +xs_LTLIBRARIES += libtexinfo.la endif # The files in the main directory correspond to code used both @@ -279,7 +279,7 @@ $(srcdir)/main/options_init_free.c $(srcdir)/main/options_types.h $(srcdir)/main # FIXME this is an internal library. Do not put it in lib? # it still needs to be found by the linker. if HAVE_ICONV -lib_LTLIBRARIES += libtexinfoxs.la +xs_LTLIBRARIES += libtexinfoxs.la endif libtexinfoxs_la_SOURCES= \ Then after "make install", $ strace perl `which texi2any` ../../m4.texi 2>log $ grep texinfo\\.so log openat(AT_FDCWD, "/usr/local/lib/libtexinfo.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "glibc-hwcaps/x86-64-v2/libtexinfo.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "tls/x86_64/x86_64/libtexinfo.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "tls/x86_64/libtexinfo.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "tls/x86_64/libtexinfo.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "tls/libtexinfo.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "x86_64/x86_64/libtexinfo.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "x86_64/libtexinfo.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "x86_64/libtexinfo.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "libtexinfo.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/local/lib/texinfo/libtexinfo.so.0", O_RDONLY|O_CLOEXEC) = 7 $ grep texinfoxs\\.so log openat(AT_FDCWD, "/usr/local/lib/libtexinfoxs.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "glibc-hwcaps/x86-64-v2/libtexinfoxs.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "tls/x86_64/x86_64/libtexinfoxs.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "tls/x86_64/libtexinfoxs.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "tls/x86_64/libtexinfoxs.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "tls/libtexinfoxs.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "x86_64/x86_64/libtexinfoxs.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "x86_64/libtexinfoxs.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "x86_64/libtexinfoxs.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "libtexinfoxs.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/local/lib/texinfo/glibc-hwcaps/x86-64-v2/libtexinfoxs.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/local/lib/texinfo/tls/x86_64/x86_64/libtexinfoxs.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/local/lib/texinfo/tls/x86_64/libtexinfoxs.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/local/lib/texinfo/tls/x86_64/libtexinfoxs.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/local/lib/texinfo/tls/libtexinfoxs.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/local/lib/texinfo/x86_64/x86_64/libtexinfoxs.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/local/lib/texinfo/x86_64/libtexinfoxs.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/local/lib/texinfo/x86_64/libtexinfoxs.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/local/lib/texinfo/libtexinfoxs.so.0", O_RDONLY|O_CLOEXEC) = 7 Well, it finds it in the right location. But is looking under /usr/local/lib first - not good really, as if the user installs some other libtexinfoxs.so library in /usr/local/lib, completely the wrong library might be loaded.
