On Wed, Jan 14, 2026 at 06:44:08PM +0200, Eli Zaretskii wrote:
> $ /d/usr/Perl/bin/perl -V:perllibs
> perllibs='-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32
> -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr
> -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32';
>
> All of the libraries it mentions are Windows system libraries. The
> only exception is -luuid, which is missing. To overcome that problem,
> I simply built and installed libuuid, which gave me an import library
> and a DLL. This solved the problem of libtool refusing to build XS as
> shared libraries. None of the built DLLs actually need libuuid, so
> its only role here is to pacify the linker, which sees the -luuid
> switch and therefore must find a corresponding import library in order
> to be able to produce a DLL.
In the mean time, I removed perllibs from the link command... I do not
have a good feeling on what should be best. In theory it should be
better with it, but in practice, it has never been needed and has
occasionally posed problem.
> The other problem was to avoid putting junk into tta/C/Makefile
> because of the error message "perl -MExtUtils::Embed -e ldopts" emits.
> I suggest to solve this by redirecting its stderr to the null device,
> like this:
>
> PERL_EXTUTILS_EMBED_ccopts=
> PERL_EXTUTILS_EMBED_ldopts=
> if test "z$extutils_embed" = 'zyes' ; then
> PERL_EXTUTILS_EMBED_ccopts=`${PERL} -MExtUtils::Embed -e ccopts 2>
> /dev/null`
> PERL_EXTUTILS_EMBED_ldopts=`${PERL} -MExtUtils::Embed -e ldopts 2>
> /dev/null`
> fi
>
> In addition, I think we should run the output through a Sed script
> that replaces backslashes with forward slashes. That's because the
> output is
>
> -s -static-libgcc -static-libstdc++ -L"D:\usr\Perl\lib\CORE"
> -L"C:\MinGW\i686-w64-mingw32\lib" D:\usr\Perl\lib\CORE\libperl520.a
>
> and the backslashes then cause Bash to produce nonsensical file names
> like D:usrPerllibCORElibperl520.a, which then fails generation of XS
> shared libraries down the line (libtool doesn't find the file, and
> assumes it's a static archive, not an import library). Something like
> this:
>
> PERL_EXTUTILS_EMBED_ldopts=`${PERL} -MExtUtils::Embed -e ldopts 2>
> /dev/null | sed -e 's,\\,/,g'`
>
> and similarly with ccopts. I think this can be done on all platforms,
> since only on Windows Perl might report file names with backslashes.
In the mean time I also removed the use of ExtUtils::Embed, and replaced
by an explicit selection of options, but I think that it is a good thing
to be able to at least see the ExtUtils::Embed output, so I left the
code in comment, I'll apply what you propose.
--
Pat