Re: no search of XS modules in @INC

Gavin Smith <[email protected]>
Newsgroups gmane.comp.tex.texinfo.bugs
Message-ID <aawqvvkGMBO1XZc7@orangestar>
On Sat, Mar 07, 2026 at 01:42:55PM +0100, Patrice Dumas wrote:
> Hello,
> 
> Currently the XS modules, in practice the associated libtool-generated
> .la files are searched for in @INC Perl path directories array.  I think
> that it is not a good idea for two reasons:
> 
> 1) we actually know exactly where the modules will be found and we put
>   the corresponding directories in front of @INC.  Using @INC add come
>   complexity, a little bit of inefficiency and useless information to
>   XS loading debugging messages but has no effect.
> 
> 2) we do not follow the Perl conventions for XS modules paths, that are
>   in auto/<package> in @INC directories.  Therefore it is very likely that
>   if we find something on @INC it is not what we are looking for.  And
>   also this could be confusing for people knowing Perl well and not
>   getting the module they expect to be loaded.
> 
> I think that we should setup our own path, which could actually be only
> one directory, and if we want to add to it, we should use a
> customization or command-line variable or specific ENV variable.  We
> consider these XS modules internal, it is more consistent that we set a
> separate path, if we need one.  I do not think that we need to be able
> to set a path, actually.

OK that sounds fine.  There is a comment in XSLoader.pm:

# We look for the .la and .so files in @INC because this allows us to override
# which modules are used using -I flags to "perl".

However, I'm not sure if or where we use these -I flags.  I had a look at
a few Makefile.am files but didn't see anything.

The DynaLoader manpages only mentions using @INC in a function that we
don't call, I believe (DynaLoader::bootstrap, not to be confused with the
bootstrap XSUB of the XS module).
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.