Skip to content

5.41.13 thru EU::MM 7.72 breaks all i386 Win32 XS .dll during linking if they add any extra "-lsome_c_lib"es #23331

@bulk88

Description

@bulk88

Module: EU::MM in blead

Description

This bug blocks Perl 5.42.0. I don't have time to rewrite all this ATM.

<bulk88> Revision: 179356156963a4b43629d91b6c8abc3030e76739 Author: Chris
'BinGOs' Williams <[email protected]> Date: 3/14/2025 7:39:15 AM
Message: Update ExtUtils-MakeMaker to CPAN version 7.72
<bulk88> i386 WinGCCPerl's XS .dll files are ABI uncompileable if ```
WriteMakefile(LIBS => '-lwinspool -lgui32 -lprinter32 -lmouse32'); ``` is
executed
<bulk88> I need to sleep but that "improvement" telling Mingw GCC to scan
the headers of any .dll file in %PATH% and totally ignoring all .a disk
files, is incompatible with i386's __stdcall name mangling
<bulk88> Win64 has 1.001 calling conventions aka ABIs, Win32 i386 had 4-6
ABIs/calling conventions, all in 1 address space
<bulk88> mohawk_ic try a i386 blead perl GCC compile
<bulk88> Yes I know Strawberry's dev team doesn't have institutional
knowledge how to compile an i386 Strawberry Perl anymore
* bulk88 will note Strawberry Perl is 1000x more difficult to compile than
P5Ps tarball, the first is compiling Debian from src, the 2nd is just 1
tarball
<bulk88>
C:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw
<bulk88> 32/bin/ld.exe: Win32.o:Win32.c:(.text+0x9e8): undefined reference
to `_imp__Stri
<bulk88> ngFromCLSID@8'
<bulk88> nothing will ever fix this message except a .def file and a .a
file on Win32
<bulk88> MS renames the C Abstract Linker Symbols's ASCII names before
inserting them into their export table
<bulk88> unless your a i386 machine code decompiler/regexp-er, or have
prior knowledge, you can't automatically figure out from just looking at
ascii disk file names of __stdcall functions, if they are __stdcall or
__cdecl insider C Abstract linker
<bulk88> special casing, MS .dll
<bulk88> 'es only, and perhaps people like me who found the secret cmd
line arg to unmangle the ascii names of functions for the export table
only
<bulk88> because nobody will ever remember to write fnptr =
dl_sym(lib_ptr, "_MultiByteToWideChar@28");

problem code inside cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm

@@ -460,8 +446,8 @@ sub _win32_try_attach_extension {
 }
 
 sub _win32_lib_extensions {
-    my @extensions;
-    push @extensions, $Config{'lib_ext'} if $Config{'lib_ext'};
+    my @extensions = grep $_, @Config{qw(lib_ext)};
+    push @extensions, map ".$_", grep $_, @Config{qw(dlext so)};
     push @extensions, '.dll.a' if grep { m!^\.a$! } @extensions;
     push @extensions, '.lib' unless grep { m!^\.lib$! } @extensions;
     return \@extensions;

console failure

gmake[1]: Entering directory 'C:/sources/perl5/cpan/Time-Piece'
"C:\sources\perl5\miniperl.exe" "-I..\..\lib" -MExtUtils::Command::MM -e cp_none
mpty -- Piece.bs ..\..\lib\auto\Time\Piece\Piece.bs 644
g++ Piece.def -o ..\..\lib\auto\Time\Piece\Piece.dll -shared -s -L"c:\perl\lib\C
ORE" -L"C:\MinGW\lib" -L"C:\MinGW\i686-w64-mingw32\lib" -L"C:\MinGW\lib\gcc\i686
-w64-mingw32\8.3.0" Piece.o   "..\..\lib\CORE\libperl541.a" -lmoldname -lkernel3
2 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32
 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl
32 -Wl,--enable-auto-image-base
"C:\sources\perl5\miniperl.exe" "-I..\..\lib" -MExtUtils::Command -e chmod -- 75
5 ..\..\lib\auto\Time\Piece\Piece.dll
gmake[1]: Leaving directory 'C:/sources/perl5/cpan/Time-Piece'
gmake[1]: Entering directory 'C:/sources/perl5/cpan/Unicode-Collate'
"C:\sources\perl5\miniperl.exe" "-I..\..\lib" -MExtUtils::Command::MM -e cp_none
mpty -- Collate.bs ..\..\lib\auto\Unicode\Collate\Collate.bs 644
g++ Collate.def -o ..\..\lib\auto\Unicode\Collate\Collate.dll -shared -s -L"c:\p
erl\lib\CORE" -L"C:\MinGW\lib" -L"C:\MinGW\i686-w64-mingw32\lib" -L"C:\MinGW\lib
\gcc\i686-w64-mingw32\8.3.0" Collate.o   "..\..\lib\CORE\libperl541.a" -lmoldnam
e -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32
 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp
32 -lcomctl32 -Wl,--enable-auto-image-base
"C:\sources\perl5\miniperl.exe" "-I..\..\lib" -MExtUtils::Command -e chmod -- 75
5 ..\..\lib\auto\Unicode\Collate\Collate.dll
gmake[1]: Leaving directory 'C:/sources/perl5/cpan/Unicode-Collate'
gmake[1]: Entering directory 'C:/sources/perl5/cpan/Win32'
Makefile out-of-date with respect to Makefile.PL
Cleaning current config before rebuilding Makefile...
gmake -f Makefile.old clean > NUL
"C:\sources\perl5\miniperl.exe" "-I..\..\lib" Makefile.PL "INSTALLDIRS=perl" "IN
STALLMAN1DIR=none" "INSTALLMAN3DIR=none" "PERL_CORE=1" "PERL=C:\sources\perl5\mi
niperl.exe"
Warning (mostly harmless): No library found for
Warning (mostly harmless): No library found for -lmoldname
Warning (mostly harmless): No library found for -lwinspool
Warning (mostly harmless): No library found for -luuid
Generating a gmake-style Makefile
Writing Makefile for Win32
==> Your Makefile has been rebuilt. <==
==> Please rerun the gmake command.  <==
"C:\sources\perl5\miniperl.exe" "-I..\..\lib"  -e "exit 1" --
gmake[1]: *** [Makefile:924: Makefile] Error 1
gmake[1]: Leaving directory 'C:/sources/perl5/cpan/Win32'
gmake[1]: Entering directory 'C:/sources/perl5/cpan/Win32'
Running Mkbootstrap for Win32 ()
"C:\sources\perl5\miniperl.exe" "-I..\..\lib" -MExtUtils::Command -e chmod -- 64
4 "Win32.bs"
"C:\sources\perl5\miniperl.exe" "-I..\..\lib" -MExtUtils::Command::MM -e cp_none
mpty -- Win32.bs ..\..\lib\auto\Win32\Win32.bs 644
"C:\sources\perl5\miniperl.exe" "-I..\..\lib" "..\..\lib\ExtUtils/xsubpp"  -type
map C:\sources\perl5\lib\ExtUtils\typemap  Win32.xs > Win32.xsc
"C:\sources\perl5\miniperl.exe" "-I..\..\lib" -MExtUtils::Command -e mv -- Win32
.xsc Win32.c
gcc -c   -std=c99 -DWIN32 -DPERL_TEXTMODE_SCRIPTS -DMULTIPLICITY -DPERL_IMPLICIT
_SYS -DUSE_PERLIO -D__USE_MINGW_ANSI_STDIO -fwrapv -fno-strict-aliasing -mms-bit
fields -Os   -DVERSION=\"0.59_02\" -DXS_VERSION=\"0.59_02\"  "-I..\..\lib\CORE"
  Win32.c
"C:\sources\perl5\miniperl.exe" "-I..\..\lib" -MExtUtils::Mksymlists \
     -e "Mksymlists('NAME'=>\"Win32\", 'DLBASE' => 'Win32', 'DL_FUNCS' => {  },
'FUNCLIST' => [], 'IMPORTS' => {  }, 'DL_VARS' => []);"
g++ Win32.def -o ..\..\lib\auto\Win32\Win32.dll -shared -s -L"c:\perl\lib\CORE"
-L"C:\MinGW\lib" -L"C:\MinGW\i686-w64-mingw32\lib" -L"C:\MinGW\lib\gcc\i686-w64-
mingw32\8.3.0" Win32.o   "..\..\lib\CORE\libperl541.a" "C:\Windows\system32\ole3
2.dll" "C:\Windows\system32\version.dll" "C:\Windows\system32\netapi32.dll" "C:\
Windows\system32\userenv.dll" "C:\Windows\system32\winhttp.dll" "C:\Windows\syst
em32\kernel32.dll" "C:\Windows\system32\user32.dll" "C:\Windows\system32\gdi32.d
ll" "C:\Windows\system32\comdlg32.dll" "C:\Windows\system32\advapi32.dll" "C:\Wi
ndows\system32\shell32.dll" "C:\Windows\system32\ole32.dll" "C:\Windows\system32
\oleaut32.dll" "C:\Windows\system32\netapi32.dll" "C:\Windows\system32\ws2_32.dl
l" "C:\Windows\system32\mpr.dll" "C:\Windows\system32\winmm.dll" "C:\Windows\sys
tem32\version.dll" "C:\Windows\system32\odbc32.dll" "C:\Windows\system32\odbccp3
2.dll" "C:\Windows\system32\comctl32.dll" -Wl,--enable-auto-image-base
C:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw
32/bin/ld.exe: warning: resolving _NetWkstaGetInfo@12 by linking to _NetWkstaGet
Info
Use --enable-stdcall-fixup to disable these warnings
Use --disable-stdcall-fixup to disable these fixups
C:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw
32/bin/ld.exe: warning: resolving _NetApiBufferFree@4 by linking to _NetApiBuffe
rFree
C:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw
32/bin/ld.exe: warning: resolving _GetFileVersionInfoSizeA@8 by linking to _GetF
ileVersionInfoSizeA
C:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw
32/bin/ld.exe: warning: resolving _GetFileVersionInfoA@16 by linking to _GetFile
VersionInfoA
C:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw
32/bin/ld.exe: warning: resolving _VerQueryValueA@16 by linking to _VerQueryValu
eA
C:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw
32/bin/ld.exe: warning: resolving _CreateEnvironmentBlock@12 by linking to _Crea
teEnvironmentBlock
C:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw
32/bin/ld.exe: warning: resolving _DestroyEnvironmentBlock@4 by linking to _Dest
royEnvironmentBlock
C:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw
32/bin/ld.exe: Win32.o:Win32.c:(.text+0x9bf): undefined reference to `_imp__CoCr
eateGuid@4'
C:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw
32/bin/ld.exe: Win32.o:Win32.c:(.text+0x9e8): undefined reference to `_imp__Stri
ngFromCLSID@8'
C:/Strawberry/c/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw
32/bin/ld.exe: Win32.o:Win32.c:(.text+0xa4b): undefined reference to `_imp__CoTa
skMemFree@4'
collect2.exe: error: ld returned 1 exit status
gmake[1]: *** [Makefile:477: ..\..\lib\auto\Win32\Win32.dll] Error 1
gmake[1]: Leaving directory 'C:/sources/perl5/cpan/Win32'
Unsuccessful make(cpan/Win32): code=512 at ..\make_ext.pl line 584.
gmake: *** [GNUmakefile:1562: Extensions] Error 2

C:\sources\perl5\win32>

Steps to Reproduce

Try building a i386 WinMingwGCCPerl with 5.41.13

Expected behavior

I have a new i386 WinGCCPerl on my disk.

Perl configuration

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions