Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Win32] 5.25.2 fails to build in ListUtil.xs #15400

Closed
p5pRT opened this issue Jun 21, 2016 · 26 comments
Closed

[Win32] 5.25.2 fails to build in ListUtil.xs #15400

p5pRT opened this issue Jun 21, 2016 · 26 comments

Comments

@p5pRT
Copy link

p5pRT commented Jun 21, 2016

Migrated from rt.perl.org#128438 (status was 'resolved')

Searchable as RT128438$

@p5pRT
Copy link
Author

p5pRT commented Jun 21, 2016

From @sisyphus

Hi,

I'm using mingw-w64 ports of gcc-5.3.0 (both 64-bit and 32-bit) and failing
to build a fairly standard configurations of perl 5.25.2 (both with and
without uselongdouble).

The error is always the same​:

In file included from ListUtil.xs​:7​:0​:
ListUtil.xs​: In function 'XS_List__Util_reduce'​:
ListUtil.xs​:18​:44​: error​: 'newsp' undeclared (first use in this function)
# define UNUSED_VAR_newsp PERL_UNUSED_VAR(newsp)

Cheers,
Rob

@p5pRT
Copy link
Author

p5pRT commented Jun 21, 2016

From @tonycoz

On Mon, Jun 20, 2016 at 06​:52​:51PM -0700, Sisyphus wrote​:

# New Ticket Created by "Sisyphus"
# Please include the string​: [perl #128438]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=128438 >

Hi,

I'm using mingw-w64 ports of gcc-5.3.0 (both 64-bit and 32-bit) and failing
to build a fairly standard configurations of perl 5.25.2 (both with and
without uselongdouble).

The error is always the same​:

In file included from ListUtil.xs​:7​:0​:
ListUtil.xs​: In function 'XS_List__Util_reduce'​:
ListUtil.xs​:18​:44​: error​: 'newsp' undeclared (first use in this function)
# define UNUSED_VAR_newsp PERL_UNUSED_VAR(newsp)

It's a bug in one of the optimizations done in GNUmakefile and
makefile.mk when they were parallelized.

Instead of building a full ppport.h for XS modules to use, those
makefiles instead build a dummy ppport.h.

The assumption made at the time the optimization was done was that
ppport.h only provides wrappers for perl API functions/macros, but it
provides at least one extension of its own​: PERL_BCDVERSION.

I plan to make them build ppport.h properly.

Tony

@p5pRT
Copy link
Author

p5pRT commented Jun 21, 2016

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jun 21, 2016

From @sisyphus

-----Original Message-----
From​: Tony Cook
Sent​: Tuesday, June 21, 2016 2​:42 PM
To​: perl5-porters@​perl.org
Subject​: Re​: [perl #128438] [Win32] 5.25.2 fails to build in ListUtil.xs

The error is always the same​:

In file included from ListUtil.xs​:7​:0​:
ListUtil.xs​: In function 'XS_List__Util_reduce'​:
ListUtil.xs​:18​:44​: error​: 'newsp' undeclared (first use in this function)
# define UNUSED_VAR_newsp PERL_UNUSED_VAR(newsp)

It's a bug in one of the optimizations done in GNUmakefile and makefile.mk
when they were parallelized.

Instead of building a full ppport.h for XS modules to use, those makefiles
instead build a dummy ppport.h.

The assumption made at the time the optimization was done was that
ppport.h only provides wrappers for perl API functions/macros, but it
provides at least one extension of its own​: PERL_BCDVERSION.

I plan to make them build ppport.h properly.

By the time the error occurs, ppport.h is already to be found in
cpan/Devel-PPPort.
So I replaced the empty ppport.h that was in lib/CORE with a copy of that
cpan/Devel-PPPort/ppport.h, and the build was then achieved by simply
re-running 'make'.
That's good enough for now.

Thanks for the pointer, Tony.

Cheers,
Rob

@p5pRT
Copy link
Author

p5pRT commented Jun 22, 2016

From @tonycoz

On Mon Jun 20 18​:52​:51 2016, sisyphus wrote​:

Hi,

I'm using mingw-w64 ports of gcc-5.3.0 (both 64-bit and 32-bit) and failing
to build a fairly standard configurations of perl 5.25.2 (both with and
without uselongdouble).

The error is always the same​:

In file included from ListUtil.xs​:7​:0​:
ListUtil.xs​: In function 'XS_List__Util_reduce'​:
ListUtil.xs​:18​:44​: error​: 'newsp' undeclared (first use in this function)
# define UNUSED_VAR_newsp PERL_UNUSED_VAR(newsp)

Please try the attached patch.

Tony

@p5pRT
Copy link
Author

p5pRT commented Jun 22, 2016

From @tonycoz

0001-perl-128438-build-ppport.h-instead-of-using-a-dummy-.patch
From c6d7175037b69051c82f6f4d38de030ec60f60d4 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Wed, 22 Jun 2016 15:43:21 +1000
Subject: [PATCH] (perl #128438) build ppport.h instead of using a dummy file

The changes to parallelize win32 perl builds with dmake and gmake
assumed that ppport.h only provided macros and functions that are
already provided by the latest perl.

This turns out not to be the case, preventing the building of
a new Scalar-List-Utils with dmake and gmake.

I only briefly considered changing Scalar-List-Utils - the difference
in build systems is what lead to the failure, so properly build ppport.h
so that all Win32 builds have a full ppport.h just as POSIXish builds
do.
---
 win32/.gitignore  |  1 +
 win32/GNUmakefile | 21 ++++++++++++---------
 win32/makefile.mk | 20 ++++++++++----------
 3 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/win32/.gitignore b/win32/.gitignore
index 9719332..56dee9f 100644
--- a/win32/.gitignore
+++ b/win32/.gitignore
@@ -6,6 +6,7 @@ bin/*.bat
 html/
 mini/
 Extensions_static
+.coreheaders
 dlutils.c
 perllibst.h
 perlmain.c
diff --git a/win32/GNUmakefile b/win32/GNUmakefile
index 112ea4c..0fc3e58 100644
--- a/win32/GNUmakefile
+++ b/win32/GNUmakefile
@@ -998,9 +998,8 @@ UUDMAP_H	= ..\uudmap.h
 BITCOUNT_H	= ..\bitcount.h
 MG_DATA_H	= ..\mg_data.h
 GENERATED_HEADERS = $(UUDMAP_H) $(BITCOUNT_H) $(MG_DATA_H)
-#a stub ppport.h must be generated so building XS modules, .c->.obj wise, will
-#work, so this target also represents creating the COREDIR and filling it
-HAVE_COREDIR	= $(COREDIR)\ppport.h
+
+HAVE_COREDIR	= .coreheaders
 
 MICROCORE_OBJ	= $(MICROCORE_SRC:.c=$(o))
 CORE_OBJ	= $(MICROCORE_OBJ) $(EXTRACORE_SRC:.c=$(o))
@@ -1419,10 +1418,13 @@ else
 	$(EMBED_EXE_MANI)
 endif
 
-#This generates a stub ppport.h & creates & fills /lib/CORE to allow for XS
-#building .c->.obj wise (linking is a different thing). This target is AKA
-#$(HAVE_COREDIR).
-$(COREDIR)\ppport.h : $(CORE_H)
+.PHONY: MakePPPort
+
+MakePPPort : $(HAVEMINIPERL) $(CONFIGPM)
+	$(MINIPERL) -I..\lib ..\mkppport
+
+# also known as $(HAVE_COREDIR)
+.coreheaders : $(CORE_H)
 	$(XCOPY) *.h $(COREDIR)\\*.*
 	$(RCOPY) include $(COREDIR)\\*.*
 	$(XCOPY) ..\\*.h $(COREDIR)\\*.*
@@ -1461,7 +1463,7 @@ endif
 # DynaLoader.pm, so this will have to do
 
 #most of deps of this target are in DYNALOADER and therefore omitted here
-Extensions : $(PERLDEP) $(DYNALOADER) $(GLOBEXE)
+Extensions : $(PERLDEP) $(DYNALOADER) $(GLOBEXE) MakePPPort
 	$(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(PLMAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic !Unicode/Normalize
 
 Extensions_normalize : $(PERLDEP) $(DYNALOADER) $(GLOBEXE) $(UNIDATAFILES)
@@ -1470,7 +1472,7 @@ Extensions_normalize : $(PERLDEP) $(DYNALOADER) $(GLOBEXE) $(UNIDATAFILES)
 Extensions_reonly : $(PERLDEP) $(DYNALOADER)
 	$(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(PLMAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic +re
 
-Extensions_static : ..\make_ext.pl list_static_libs.pl $(CONFIGPM) $(GLOBEXE) $(HAVE_COREDIR)
+Extensions_static : ..\make_ext.pl list_static_libs.pl $(CONFIGPM) $(GLOBEXE) $(HAVE_COREDIR) MakePPPort
 	$(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(PLMAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --static
 	$(MINIPERL) -I..\lib list_static_libs.pl > Extensions_static
 
@@ -1769,6 +1771,7 @@ _clean :
 	-@erase $(PERLDLL)
 	-@erase $(CORE_OBJ)
 	-@erase $(GENUUDMAP) $(GENUUDMAP_OBJ) $(GENERATED_HEADERS)
+	-@erase .coreheaders
 	-if exist $(MINIDIR) rmdir /s /q $(MINIDIR)
 	-if exist $(UNIDATADIR1) rmdir /s /q $(UNIDATADIR1)
 	-if exist $(UNIDATADIR2) rmdir /s /q $(UNIDATADIR2)
diff --git a/win32/makefile.mk b/win32/makefile.mk
index 58abd45..29c2ce6 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -985,9 +985,8 @@ UUDMAP_H	= ..\uudmap.h
 BITCOUNT_H	= ..\bitcount.h
 MG_DATA_H	= ..\mg_data.h
 GENERATED_HEADERS = $(UUDMAP_H) $(BITCOUNT_H) $(MG_DATA_H)
-#a stub ppport.h must be generated so building XS modules, .c->.obj wise, will
-#work, so this target also represents creating the COREDIR and filling it
-HAVE_COREDIR	= $(COREDIR)\ppport.h
+
+HAVE_COREDIR	= .\.coreheaders
 
 MICROCORE_OBJ	= $(MICROCORE_SRC:db:+$(o))
 CORE_OBJ	= $(MICROCORE_OBJ) $(EXTRACORE_SRC:db:+$(o))
@@ -1387,10 +1386,11 @@ $(GENUUDMAP) $(GENERATED_HEADERS) .UPDATEALL : ..\mg_raw.h
 .ENDIF
 	$(GENUUDMAP) $(GENERATED_HEADERS)
 
-#This generates a stub ppport.h & creates & fills /lib/CORE to allow for XS
-#building .c->.obj wise (linking is a different thing). This target is AKA
-#$(HAVE_COREDIR).
-$(COREDIR)\ppport.h : $(CORE_H)
+MakePPPort : $(HAVEMINIPERL) $(CONFIGPM)
+	$(MINIPERL) -I..\lib ..\mkppport
+
+# also known as $(HAVE_COREDIR)
+.\.coreheaders : $(CORE_H)
 	$(XCOPY) *.h $(COREDIR)\*.* && $(RCOPY) include $(COREDIR)\*.* && $(XCOPY) ..\*.h $(COREDIR)\*.*
 	rem. > $@
 
@@ -1427,7 +1427,7 @@ $(PERLEXESTATIC): $(PERLSTATICLIB) $(CONFIGPM) $(PERLEXEST_OBJ) $(PERLEXE_RES)
 # DynaLoader.pm, so this will have to do
 
 #most of deps of this target are in DYNALOADER and therefore omitted here
-Extensions : $(PERLDEP) $(DYNALOADER) $(GLOBEXE)
+Extensions : $(PERLDEP) $(DYNALOADER) $(GLOBEXE) MakePPPort
 	$(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(PLMAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic !Unicode/Normalize
 
 Extensions_normalize : $(PERLDEP) $(DYNALOADER) $(GLOBEXE) $(UNIDATAFILES)
@@ -1436,7 +1436,7 @@ Extensions_normalize : $(PERLDEP) $(DYNALOADER) $(GLOBEXE) $(UNIDATAFILES)
 Extensions_reonly : $(PERLDEP) $(DYNALOADER)
 	$(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(PLMAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic +re
 
-Extensions_static : ..\make_ext.pl list_static_libs.pl $(CONFIGPM) $(GLOBEXE) $(HAVE_COREDIR)
+Extensions_static : ..\make_ext.pl list_static_libs.pl $(CONFIGPM) $(GLOBEXE) $(HAVE_COREDIR) MakePPPort
 	$(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(PLMAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --static
 	$(MINIPERL) -I..\lib list_static_libs.pl > Extensions_static
 
@@ -1644,7 +1644,6 @@ install : all installbare installhtml
 
 installbare : utils ..\pod\perltoc.pod
 	$(PERLEXE) ..\installperl
-	attrib -r $(INST_COREDIR)\ppport.h && del $(INST_COREDIR)\ppport.h
 	if exist $(WPERLEXE) $(XCOPY) $(WPERLEXE) $(INST_BIN)\*.*
 	if exist $(PERLEXESTATIC) $(XCOPY) $(PERLEXESTATIC) $(INST_BIN)\*.*
 	$(XCOPY) $(GLOBEXE) $(INST_BIN)\*.*
@@ -1735,6 +1734,7 @@ _clean :
 	-@erase $(PERLDLL)
 	-@erase $(CORE_OBJ)
 	-@erase $(GENUUDMAP) $(GENUUDMAP_OBJ) $(GENERATED_HEADERS)
+	-@erase .coreheaders
 	-if exist $(MINIDIR) rmdir /s /q $(MINIDIR)
 	-if exist $(UNIDATADIR1) rmdir /s /q $(UNIDATADIR1)
 	-if exist $(UNIDATADIR2) rmdir /s /q $(UNIDATADIR2)
-- 
2.7.0.windows.1

@p5pRT
Copy link
Author

p5pRT commented Jun 22, 2016

From @sisyphus

-----Original Message-----
From​: Tony Cook via RT

In file included from ListUtil.xs​:7​:0​:
ListUtil.xs​: In function 'XS_List__Util_reduce'​:
ListUtil.xs​:18​:44​: error​: 'newsp' undeclared (first use in this function)
# define UNUSED_VAR_newsp PERL_UNUSED_VAR(newsp)

Please try the attached patch.

The patch to GNUmakefile does the trick, and the one to makefile.mk might
also be correct - but it seems there's another issue with the makefile.mk
that's taking precedence over the ppport issue.

I hadn't tried building with dmake since 5.23.something, but when I build
5.25.2 (using 32-bit gcc-5.3.0) with dmake I get the attached dmake.txt as
outptut - and that's irrespective of whether I've applied your makefile.mk
patch or not.

Is my problem with the dmake build a PEBCAK ?
(In the makefile.mk, I had uncommented in the "WIN64 *= undef" which,
incidentally, is something one apparently does *not* have to do with the
GNUmakefile when building for 32-bit on 64-bit windows - despite the advice
to the contrary in the comments.)

The changes to parallelize win32 perl builds with dmake and gmake assumed
that ppport.h only provided macros and functions that are already provided
by the latest perl.

A perfectly reasonable assumption, IMO.
That matches my understanding of what ppport.h is supposed to be providing.

Cheers,
Rob

@p5pRT
Copy link
Author

p5pRT commented Jun 22, 2016

From @sisyphus

dmake​: Executing shell macro​: for /f "delims=. tokens=1,2,3" %i in
('$(CC) -dumpversion') do @​if "%i"=="4" (if "%j" geq "3" echo define) else
if "%i" geq "5" (echo define)
if not exist ".\mini" mkdir ".\mini"
copy config_H.gc config.h
  1 file(s) copied.
rem. > .\mini\.exists
gcc -c -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -f
no-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\toke.o
..\toke.c
gcc -c -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -f
no-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\regcomp.o
..\regcomp.c
gcc -c -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -f
no-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\regexec.o
..\regexec.c
gcc -c -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -f
no-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\op.o
..\op.c
gcc -c -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -f
no-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\sv.o
..\sv.c
gcc -c -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -f
no-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\pp.o
..\pp.c
gcc -c -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -f
no-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\pp_ctl.o
..\pp_ctl.c
gcc -c -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -f
no-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\pp_sys.o
..\pp_sys.c
gcc -c -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -f
no-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\pp_pack.o
..\pp_pack.c
gcc -c -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -f
no-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\pp_hot.o
..\pp_hot.c
gcc -c -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -f
no-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\gv.o
..\gv.c
gcc -c -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -f
no-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\perl.o
..\perl.c
gcc -c -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -f
no-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\utf8.o
..\utf8.c
gcc -c -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -f
no-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\dump.o
..\dump.c
gcc -c -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -f
no-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\hv.o
..\hv.c
gcc -c -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -f
no-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\av.o
..\av.c
gcc -c -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -f
no-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\caretx.o
..\caretx.c
gcc -c -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -f
no-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\deb.o
..\deb.c
gcc -c -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -f
no-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\doio.o
..\doio.c
gcc -c -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -f
no-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\doop.o
..\doop.c
gcc -c -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -fwrapv -f
no-strict-aliasing -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -omini\dquote.o
..\dquote.c
g++ -I.\include -I. -I.. -DWIN32 -DPERLDLL -DPERL_CORE -s -O2 -DPERL_TEXTM
ODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fwrapv -fno-strict-
aliasing -mms-bitfields -o..\generate_uudmap.exe ..\generate_uudmap.c \
  -s -L"c​:\perl\lib\CORE" -L"C​:\MinGW\lib" -x
C​:\Users\sisyphus\AppData\Local\Temp\mk9
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x3e)​: undefined
reference to `mingw_initcharmax'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x4e)​: undefined
reference to `mingw_app_type'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x6a)​: undefined
reference to `_encode_pointer'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x75)​: undefined
reference to `__onexitend'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x7a)​: undefined
reference to `__onexitbegin'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x86)​: undefined
reference to `_setargv'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x8c)​: undefined
reference to `_MINGW_INSTALL_DEBUG_MATHERR'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x103)​: undefined
reference to `_matherr'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x108)​: undefined
reference to `__mingw_setusermatherr'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x134)​: undefined
reference to `_newmode'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x15d)​: undefined
reference to `_dowildcard'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x1e3)​: undefined
reference to `mingw_app_type'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x21c)​: undefined
reference to `__native_startup_lock'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x225)​: undefined
reference to `__native_startup_state'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x235)​: undefined
reference to `__native_startup_state'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x24c)​: undefined
reference to `__native_startup_state'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x28e)​: undefined
reference to `_gnu_exception_handler@​4'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x29c)​: undefined
reference to `__mingw_oldexcpt_handler'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x2a8)​: undefined
reference to `_set_invalid_parameter_handler'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x316)​: undefined
reference to `mingw_app_type'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x412)​: undefined
reference to `__native_startup_state'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x431)​: undefined
reference to `__native_startup_state'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x442)​: undefined
reference to `__xc_z'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x449)​: undefined
reference to `__xc_a'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x456)​: undefined
reference to `__native_startup_state'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x466)​: undefined
reference to `__native_startup_lock'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x483)​: undefined
reference to `__native_startup_state'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x48f)​: undefined
reference to `__xi_z'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x496)​: undefined
reference to `__xi_a'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x4c5)​: undefined
reference to `mingw_app_type'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x4ce)​: undefined
reference to `__security_init_cookie'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x4e5)​: undefined
reference to `mingw_app_type'
C​:/_32/gcc-mingw-530/mingw32/bin/../lib/gcc/i686-w64-mingw32/5.3.0/../../../
../i686-w64-mingw32/lib/../lib/crt2.o​:crtexe.c​:(.text+0x4ee)​: undefined
reference to `__security_init_cookie'
collect2.exe​: error​: ld returned 1 exit status
dmake​: Error code 129, while making '..\bitcount.h'

@p5pRT
Copy link
Author

p5pRT commented Jun 23, 2016

From @tonycoz

On Wed Jun 22 02​:58​:15 2016, sisyphus wrote​:

-----Original Message-----
From​: Tony Cook via RT

In file included from ListUtil.xs​:7​:0​:
ListUtil.xs​: In function 'XS_List__Util_reduce'​:
ListUtil.xs​:18​:44​: error​: 'newsp' undeclared (first use in this
function)
# define UNUSED_VAR_newsp PERL_UNUSED_VAR(newsp)

Please try the attached patch.

The patch to GNUmakefile does the trick, and the one to makefile.mk
might
also be correct - but it seems there's another issue with the
makefile.mk
that's taking precedence over the ppport issue.

I hadn't tried building with dmake since 5.23.something, but when I
build
5.25.2 (using 32-bit gcc-5.3.0) with dmake I get the attached
dmake.txt as
outptut - and that's irrespective of whether I've applied your
makefile.mk
patch or not.

Is my problem with the dmake build a PEBCAK ?
(In the makefile.mk, I had uncommented in the "WIN64 *= undef"
which,
incidentally, is something one apparently does *not* have to do with
the
GNUmakefile when building for 32-bit on 64-bit windows - despite the
advice
to the contrary in the comments.)

Right GNUmakefile detects that automatically.

I haven't installed gcc 5.3.0, but the toolchain provided with strawberry perl 5.22.1.2 32-bit still builds perl with dmake / makefile.mk

I built with the default makefile.mk, with command-line arguments​:

dmake CCHOME=c​:\sperl-5.22.1.2-32bit-portable\c\bin WIN64=undef test-prep

Tony

@p5pRT
Copy link
Author

p5pRT commented Jun 23, 2016

From @dcollinsn

I did try building perl 5.25.2 on 64-bit Windows with dmake and mingw-w64. Dmake is dmake-4.12.2.2.zip from cpan, mingw-w64 provides gcc 5.3.0.

I was able to reproduce the "ListUtil.xs​:18​:44​: error​: 'newsp' undeclared" issue, but I was not able to reproduce Sisyphus' linker issue.

Applying TonyC's patch fixed the ListUtil error on dmake for me, and perl built successfully.

@p5pRT
Copy link
Author

p5pRT commented Jun 23, 2016

From @bulk88

On Tue Jun 21 22​:45​:15 2016, tonyc wrote​:

On Mon Jun 20 18​:52​:51 2016, sisyphus wrote​:

Hi,

I'm using mingw-w64 ports of gcc-5.3.0 (both 64-bit and 32-bit) and
failing
to build a fairly standard configurations of perl 5.25.2 (both with
and
without uselongdouble).

The error is always the same​:

In file included from ListUtil.xs​:7​:0​:
ListUtil.xs​: In function 'XS_List__Util_reduce'​:
ListUtil.xs​:18​:44​: error​: 'newsp' undeclared (first use in this
function)
# define UNUSED_VAR_newsp PERL_UNUSED_VAR(newsp)

Please try the attached patch.

Tony

The core patch is unnecessary, I already submitted a patch to SLU Dual-Life/Scalar-List-Utils#47 that makes it ppport free
--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Jun 23, 2016

From @sisyphus

-----Original Message-----
From​: Dan Collins via RT
Sent​: Thursday, June 23, 2016 11​:24 AM
To​: sisyphus1@​optusnet.com.au
Subject​: [perl #128438] [Win32] 5.25.2 fails to build in ListUtil.xs

I did try building perl 5.25.2 on 64-bit Windows with dmake and mingw-w64.
Dmake is dmake-4.12.2.2.zip from cpan, mingw-w64 provides gcc 5.3.0.

I was able to reproduce the "ListUtil.xs​:18​:44​: error​: 'newsp' undeclared"
issue, but I was not able to reproduce Sisyphus' linker issue.

Yes - my issue *was* a PEBCAK. I had forgotten to set CCHOME to the correct
value in the makefile.mk.
My apologies for the inconvenience thus caused.

Applying TonyC's patch fixed the ListUtil error on dmake for me, and perl
built successfully.

Same here.

Cheers,
Rob

@p5pRT
Copy link
Author

p5pRT commented Jul 13, 2016

From @bulk88

On Wed Jun 22 23​:58​:55 2016, bulk88 wrote​:

The core patch is unnecessary, I already submitted a patch to SLU
Dual-Life/Scalar-List-Utils#47 that
makes it ppport free

Patch attached for blead.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Jul 13, 2016

From @bulk88

0001-Scalar-List-Utils-make-the-XS-code-ppport.h-free-whe.patch
From fe3f529c19df90a78bfe06e6fa1233af97be3af7 Mon Sep 17 00:00:00 2001
From: Daniel Dragan <bulk88@hotmail.com>
Date: Wed, 13 Jul 2016 17:13:30 -0400
Subject: [PATCH] Scalar-List-Utils: make the XS code ppport.h free when in
 core

ppport.h is an empty file on the Win32 Perl build and therefore
PERL_BCDVERSION macro doesn't exist/not defined. Use the core VERSION
macros, not the ppport family of VERSION macros. Make SLU ppport-free
when inside core.

submitted upstream as
https://github.com/Scalar-List-Utils/Scalar-List-Utils/pull/47
---
 Porting/Maintainers.pl                     |    2 +
 cpan/Scalar-List-Utils/ListUtil.xs         |   33 ++++++++++++++++++++++------
 cpan/Scalar-List-Utils/Makefile.PL         |    2 +-
 cpan/Scalar-List-Utils/lib/List/Util.pm    |    2 +-
 cpan/Scalar-List-Utils/lib/List/Util/XS.pm |    2 +-
 cpan/Scalar-List-Utils/lib/Scalar/Util.pm  |    2 +-
 cpan/Scalar-List-Utils/lib/Sub/Util.pm     |    2 +-
 t/porting/customized.dat                   |   11 +++++----
 8 files changed, 39 insertions(+), 17 deletions(-)

diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index ab21522..26969f3 100755
--- a/Porting/Maintainers.pl
+++ b/Porting/Maintainers.pl
@@ -951,8 +951,10 @@ use File::Glob qw(:case);
         'FILES'        => q[cpan/Scalar-List-Utils],
         # Waiting to be merged upstream
         # https://github.com/Scalar-List-Utils/Scalar-List-Utils/pull/42
+        # https://github.com/Scalar-List-Utils/Scalar-List-Utils/pull/47
         'CUSTOMIZED'   => [
             qw( ListUtil.xs
+                Makefile.PL
                 lib/List/Util.pm
                 lib/List/Util/XS.pm
                 lib/Scalar/Util.pm
diff --git a/cpan/Scalar-List-Utils/ListUtil.xs b/cpan/Scalar-List-Utils/ListUtil.xs
index cd84770..eca71ea 100644
--- a/cpan/Scalar-List-Utils/ListUtil.xs
+++ b/cpan/Scalar-List-Utils/ListUtil.xs
@@ -7,14 +7,33 @@
 #include <perl.h>
 #include <XSUB.h>
 
-#define NEED_sv_2pv_flags 1
-#include "ppport.h"
+#ifdef USE_PPPORT_H
+#  define NEED_sv_2pv_flags 1
+#  define NEED_newSVpvn_flags 1
+#  include "ppport.h"
+#endif
+
+#ifndef PERL_VERSION_DECIMAL
+#  define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
+#endif
+#ifndef PERL_DECIMAL_VERSION
+#  define PERL_DECIMAL_VERSION \
+	  PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
+#endif
+#ifndef PERL_VERSION_GE
+#  define PERL_VERSION_GE(r,v,s) \
+	  (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
+#endif
+#ifndef PERL_VERSION_LE
+#  define PERL_VERSION_LE(r,v,s) \
+	  (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
+#endif
 
-#if PERL_BCDVERSION >= 0x5006000
+#if PERL_VERSION_GE(5,6,0)
 #  include "multicall.h"
 #endif
 
-#if PERL_BCDVERSION < 0x5023008
+#if !PERL_VERSION_GE(5,23,8)
 #  define UNUSED_VAR_newsp PERL_UNUSED_VAR(newsp)
 #else
 #  define UNUSED_VAR_newsp NOOP
@@ -28,7 +47,7 @@
    was not exported. Therefore platforms like win32, VMS etc have problems
    so we redefine it here -- GMB
 */
-#if PERL_BCDVERSION < 0x5007000
+#if !PERL_VERSION_GE(5,7,0)
 /* Not in 5.6.1. */
 #  ifdef cxinc
 #    undef cxinc
@@ -870,7 +889,7 @@ PPCODE:
 /* This MULTICALL-based code appears to fail on perl 5.10.0 and 5.8.9
  * Skip it on those versions (RT#87857)
  */
-#if defined(dMULTICALL) && (PERL_BCDVERSION > 0x5010000 || PERL_BCDVERSION < 0x5008009)
+#if defined(dMULTICALL) && (PERL_VERSION_GE(5,10,1) || PERL_VERSION_LE(5,8,8))
     if(!CvISXSUB(cv)) {
         /* Since MULTICALL is about to move it */
         SV **stack = PL_stack_base + ax;
@@ -1319,7 +1338,7 @@ CODE:
     if(SvAMAGIC(sv) && (tempsv = AMG_CALLun(sv, numer))) {
         sv = tempsv;
     }
-#if PERL_BCDVERSION < 0x5008005
+#if !PERL_VERSION_GE(5,8,5)
     if(SvPOK(sv) || SvPOKp(sv)) {
         RETVAL = looks_like_number(sv) ? &PL_sv_yes : &PL_sv_no;
     }
diff --git a/cpan/Scalar-List-Utils/Makefile.PL b/cpan/Scalar-List-Utils/Makefile.PL
index 247b3b7..9859730 100644
--- a/cpan/Scalar-List-Utils/Makefile.PL
+++ b/cpan/Scalar-List-Utils/Makefile.PL
@@ -11,7 +11,7 @@ WriteMakefile(
   NAME         => q[List::Util],
   ABSTRACT     => q[Common Scalar and List utility subroutines],
   AUTHOR       => q[Graham Barr <gbarr@cpan.org>],
-  DEFINE       => q[-DPERL_EXT],
+  DEFINE       => ($ENV{PERL_CORE} ? q[-DPERL_EXT] : q[-DPERL_EXT -DUSE_PPPORT_H]),
   DISTNAME     => q[Scalar-List-Utils],
   VERSION_FROM => 'lib/List/Util.pm',
 
diff --git a/cpan/Scalar-List-Utils/lib/List/Util.pm b/cpan/Scalar-List-Utils/lib/List/Util.pm
index d537053..928833d 100644
--- a/cpan/Scalar-List-Utils/lib/List/Util.pm
+++ b/cpan/Scalar-List-Utils/lib/List/Util.pm
@@ -15,7 +15,7 @@ our @EXPORT_OK  = qw(
   all any first min max minstr maxstr none notall product reduce sum sum0 shuffle uniq uniqnum uniqstr
   pairs unpairs pairkeys pairvalues pairmap pairgrep pairfirst
 );
-our $VERSION    = "1.45_01";
+our $VERSION    = "1.45_02";
 our $XS_VERSION = $VERSION;
 $VERSION    = eval $VERSION;
 
diff --git a/cpan/Scalar-List-Utils/lib/List/Util/XS.pm b/cpan/Scalar-List-Utils/lib/List/Util/XS.pm
index 67093bd..4c181d3 100644
--- a/cpan/Scalar-List-Utils/lib/List/Util/XS.pm
+++ b/cpan/Scalar-List-Utils/lib/List/Util/XS.pm
@@ -3,7 +3,7 @@ use strict;
 use warnings;
 use List::Util;
 
-our $VERSION = "1.45_01";       # FIXUP
+our $VERSION = "1.45_02";       # FIXUP
 $VERSION = eval $VERSION;    # FIXUP
 
 1;
diff --git a/cpan/Scalar-List-Utils/lib/Scalar/Util.pm b/cpan/Scalar-List-Utils/lib/Scalar/Util.pm
index eb430cd..c322742 100644
--- a/cpan/Scalar-List-Utils/lib/Scalar/Util.pm
+++ b/cpan/Scalar-List-Utils/lib/Scalar/Util.pm
@@ -17,7 +17,7 @@ our @EXPORT_OK = qw(
   dualvar isdual isvstring looks_like_number openhandle readonly set_prototype
   tainted
 );
-our $VERSION    = "1.45_01";
+our $VERSION    = "1.45_02";
 $VERSION   = eval $VERSION;
 
 require List::Util; # List::Util loads the XS
diff --git a/cpan/Scalar-List-Utils/lib/Sub/Util.pm b/cpan/Scalar-List-Utils/lib/Sub/Util.pm
index 79e80fc..fdef2b6 100644
--- a/cpan/Scalar-List-Utils/lib/Sub/Util.pm
+++ b/cpan/Scalar-List-Utils/lib/Sub/Util.pm
@@ -15,7 +15,7 @@ our @EXPORT_OK = qw(
   subname set_subname
 );
 
-our $VERSION    = "1.45_01";
+our $VERSION    = "1.45_02";
 $VERSION   = eval $VERSION;
 
 require List::Util; # as it has the XS
diff --git a/t/porting/customized.dat b/t/porting/customized.dat
index 49fd57d..1a2a544 100644
--- a/t/porting/customized.dat
+++ b/t/porting/customized.dat
@@ -11,11 +11,12 @@ Pod::Checker cpan/Pod-Checker/t/pod/selfcheck.t 8ce3cfd38e4b9bcf5bc7fe7f2a14195e
 Pod::Checker cpan/Pod-Checker/t/pod/testcmp.pl a0cd5c8eca775c7753f4464eee96fa916e3d8a16
 Pod::Checker cpan/Pod-Checker/t/pod/testpchk.pl b2072c7f4379fd050e15424175d7cac5facf5b3b
 Pod::Perldoc cpan/Pod-Perldoc/lib/Pod/Perldoc.pm fe0bc906fb74b69cfd3fb289316ba669d770d465
-Scalar-List-Utils cpan/Scalar-List-Utils/lib/List/Util.pm e479a29c6b66ac5cbbde4ef2296afaab6c4635a6
-Scalar-List-Utils cpan/Scalar-List-Utils/lib/List/Util/XS.pm cbc38838d32fd213ae7b37ac38e30195355be3b9
-Scalar-List-Utils cpan/Scalar-List-Utils/lib/Scalar/Util.pm 14a20075dfb9a4ef33b99115ed6f43e6d1a15f9b
-Scalar-List-Utils cpan/Scalar-List-Utils/lib/Sub/Util.pm b984c0a2935bd5f5cf1733df846c8a8c0661ef32
-Scalar-List-Utils cpan/Scalar-List-Utils/ListUtil.xs 362a247c65878265fd8acae607b207400628ef3b
+Scalar-List-Utils cpan/Scalar-List-Utils/lib/List/Util.pm 4329ed96bd043044a3fe220d8fce5a2c4200ca38
+Scalar-List-Utils cpan/Scalar-List-Utils/lib/List/Util/XS.pm 728b257fbbcc2a61d6116829aef692cbae24dee4
+Scalar-List-Utils cpan/Scalar-List-Utils/lib/Scalar/Util.pm ff81acf87ec9e6e310265d0cd8e58a5401a0cfc5
+Scalar-List-Utils cpan/Scalar-List-Utils/lib/Sub/Util.pm c58eaab37d838b9b074cad413a140d98691ecfea
+Scalar-List-Utils cpan/Scalar-List-Utils/ListUtil.xs cf30d240f0473edf905ea0412af3d5c573770870
+Scalar-List-Utils cpan/Scalar-List-Utils/Makefile.PL 24a3a2e2bd2adb6d6734b620e02f5d0e2cc19891
 Socket cpan/Socket/Socket.pm 98e38176d745c38282907f391c077298f5a3d0ba
 Socket cpan/Socket/Socket.xs edd4fed212785f11c5c2095a75941dad27d586d9
 autodie cpan/autodie/t/mkdir.t 9e70d2282a3cc7d76a78bf8144fccba20fb37dac
-- 
1.7.9.msysgit.0

@p5pRT
Copy link
Author

p5pRT commented Jul 14, 2016

From @tonycoz

On Wed Jun 22 23​:58​:55 2016, bulk88 wrote​:

On Tue Jun 21 22​:45​:15 2016, tonyc wrote​:

On Mon Jun 20 18​:52​:51 2016, sisyphus wrote​:

Hi,

I'm using mingw-w64 ports of gcc-5.3.0 (both 64-bit and 32-bit) and
failing
to build a fairly standard configurations of perl 5.25.2 (both with
and
without uselongdouble).

The error is always the same​:

In file included from ListUtil.xs​:7​:0​:
ListUtil.xs​: In function 'XS_List__Util_reduce'​:
ListUtil.xs​:18​:44​: error​: 'newsp' undeclared (first use in this
function)
# define UNUSED_VAR_newsp PERL_UNUSED_VAR(newsp)

Please try the attached patch.

Tony

The core patch is unnecessary, I already submitted a patch to SLU
Dual-Life/Scalar-List-Utils#47 that
makes it ppport free

The problem is this makes Win32 an even more special snowflake than it needs to be - making it harder for CPAN upstream authors to maintain their modules.

An alternative to my original patch is to clean up the differences between the real-ppport.h and empty-ppport.h environments by adding PERL_BCDVERSION to perl.h, as per the attached patch.

Tony

@p5pRT
Copy link
Author

p5pRT commented Jul 14, 2016

From @tonycoz

0001-perl-128438-make-PERL_BCDVERSION-from-ppport.h-core.patch
From 1a4fbf151aa963c25227a98063d52700dae5d432 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Thu, 14 Jul 2016 14:54:02 +1000
Subject: [PATCH] (perl #128438) make PERL_BCDVERSION from ppport.h core

This means that Win32 [gd]make builds can continue to use a default
empty ppport.h to speed up their build process.

This reduces the unnecessary differences between the Win32 and
non-Win32 build environments.
---
 Porting/Maintainers.pl              | 3 ++-
 cpan/Devel-PPPort/parts/inc/version | 2 ++
 perl.h                              | 5 +++++
 t/porting/customized.dat            | 1 +
 4 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index ab21522..65b1073 100755
--- a/Porting/Maintainers.pl
+++ b/Porting/Maintainers.pl
@@ -346,7 +346,8 @@ use File::Glob qw(:case);
         'FILES'        => q[cpan/Devel-PPPort],
         'EXCLUDED'     => [
             'PPPort.pm',    # we use PPPort_pm.PL instead
-        ]
+        ],
+        'CUSTOMIZED'   => [ qw( parts/inc/version ) ],
     },
 
     'Devel::SelfStubber' => {
diff --git a/cpan/Devel-PPPort/parts/inc/version b/cpan/Devel-PPPort/parts/inc/version
index 1d5c556..01af2d3 100644
--- a/cpan/Devel-PPPort/parts/inc/version
+++ b/cpan/Devel-PPPort/parts/inc/version
@@ -41,8 +41,10 @@ _dpppDEC2BCD
 #  endif
 #endif
 
+#ifndef PERL_BCDVERSION
 #define _dpppDEC2BCD(dec) ((((dec)/100)<<8)|((((dec)%100)/10)<<4)|((dec)%10))
 #define PERL_BCDVERSION ((_dpppDEC2BCD(PERL_REVISION)<<24)|(_dpppDEC2BCD(PERL_VERSION)<<12)|_dpppDEC2BCD(PERL_SUBVERSION))
+#endif
 
 /* It is very unlikely that anyone will try to use this with Perl 6
    (or greater), but who knows.
diff --git a/perl.h b/perl.h
index 1f19140..4106f11 100644
--- a/perl.h
+++ b/perl.h
@@ -4701,6 +4701,11 @@ extern char **	environ;	/* environment variables supplied via exec */
 				STRINGIFY(PERL_API_VERSION) "." \
 				STRINGIFY(PERL_API_SUBVERSION)
 
+/* use the ppport name here to avoid macro redefinition errors with
+   older ppport.h files that don't guard the PERL_BCDVERSION macro */
+#define _dpppDEC2BCD(dec) ((((dec)/100)<<8)|((((dec)%100)/10)<<4)|((dec)%10))
+#define PERL_BCDVERSION ((_dpppDEC2BCD(PERL_REVISION)<<24)|(_dpppDEC2BCD(PERL_VERSION)<<12)|_dpppDEC2BCD(PERL_SUBVERSION))
+
 START_EXTERN_C
 
 /* handy constants */
diff --git a/t/porting/customized.dat b/t/porting/customized.dat
index 0fc7bec..8188c39 100644
--- a/t/porting/customized.dat
+++ b/t/porting/customized.dat
@@ -1,3 +1,4 @@
+Devel::PPPort cpan/Devel-PPPort/parts/inc/version 1b89cdcb609d2ee0c8fea96e718eb86a91cda4bc
 Encode cpan/Encode/Byte/Makefile.PL 54f446297d614331ef3f51e8310faff27cc44f90
 Encode cpan/Encode/encoding.pm 90ea1844e5ae863a17dd40ac6a0f27f438db9c1f
 ExtUtils::Constant cpan/ExtUtils-Constant/t/Constant.t a0369c919e216fb02767a637666bb4577ad79b02
-- 
2.7.0.windows.1

@p5pRT
Copy link
Author

p5pRT commented Jul 14, 2016

From @bulk88

On Wed Jul 13 21​:59​:53 2016, tonyc wrote​:

On Wed Jun 22 23​:58​:55 2016, bulk88 wrote​:

The core patch is unnecessary, I already submitted a patch to SLU
Dual-Life/Scalar-List-Utils#47 that
makes it ppport free

The problem is this makes Win32 an even more special snowflake than it
needs to be - making it harder for CPAN upstream authors to maintain
their modules.

An alternative to my original patch is to clean up the differences
between the real-ppport.h and empty-ppport.h environments by adding
PERL_BCDVERSION to perl.h, as per the attached patch.

Tony

I dont remember the default include order for EUMM .c files, but wouldn't first perl.h be included from installed CORE dir, then in the .xs/.c, ppport.h is included, but the local tarballed ppport.h is picked over the CORE one ( https://msdn.microsoft.com/en-us/library/36k2cdd4.aspx ) because all CPAN modules that use ppport.h are supposed to ship their own copy of it, which might be a very new ppport.h or very old ppport.h?

Im thinking there will still be redefinition warnings between blead perl.h and old ppport.h'es since old ppport.h'es wont have the ifndef on their PERL_BCDVERSION.

For a cpan module to be in core, it already has special requirements for its build process. It can't require XS code. It can't require an SQL server or 3rd party libs. It can't require root or a package manager (Alien cough cough). Continuing to ban ppport.h in core makes sense since many modules already do it with USE_PPPORT_H/_NOT_CORE, so its not a special snowflake scenario. Simplifying the module dependency tree is also good for all OSes to increase parallelism or decrease the number of serial building points (bulk88 wont touch the unix makefile, so bulk88 will never fix the false Math​::BigInt​::FastCalc dep on List​::Utils, this is from the IRC convo yesterday in #p5p).

Here is an idea, Im not 100% sure it is worthwhile to pursue. Im thinking maybe the empty ppport.h should contain a "#error ppport.h not available in core" instead of being empty. Greping /cpan shows all modules except two guard against using ppport.h on blead with either USE_PPPORT_H or _NOT_CORE macros. IPC-SysV and Win32API-File needs to be fixed. Pathtools and Time​::HiRes in /dist also need fixing. There are only 5 modules listed, one is SLU, in http​://perl5.git.perl.org/perl.git/blob/HEAD​:/mkppport.lst . Getting it to zero doesn't seem impossible. Then makeppport target from the root makefiles, mkppport file and mkppport.lst file can be deleted forever. Im not 100% sure putting a #error will solve anything, because just adding USE_PPPORT_H or _NOT_CORE isn't a 100% guarantee that the .xs file uses a ppport-only macro. Only looking at the code throughly might show or make it standout that it used a ppport-only macro. Also at a random point in the build, the #error ppport.h will become the full ppport.h and it wont error anymore, covering up core modules that use ppport.h when they shouldn't.

The "empty ppport.h design" already went through one round of "fix the module" last year with https​://rt.cpan.org/Public/Bug/Display.html?id=102799 https​://rt.perl.org/Ticket/Display.html?id=123867 https://rt-archive.perl.org/perl5/Ticket/Display.html?id=125807  http​://www.nntp.perl.org/group/perl.perl5.porters/2016/02/msg234196.html

Unless p5p changes blead perl to NEVER install the full ppport.h in installed CORE dir and if a CPAN on CPAN module does #include "ppport.h", and didn't ship its own copy of ppport.h in its tarball, someone can say its the module author's fault for relying on the user's existing installed, random age, possibly medieval ppport.h. IDK if this is true/right/opinions/etc.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Jul 23, 2016

From @bulk88

*bump*

I havent been able to compile blead perl on win32 without patching it for a month or 2 now.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Jul 23, 2016

From @sisyphus

-----Original Message-----
From​: bulk88 via RT
Sent​: Saturday, July 23, 2016 11​:30 AM
To​: OtherRecipients of perl Ticket #128438​:
Cc​: perl5-porters@​perl.org
Subject​: [perl #128438] [Win32] 5.25.2 fails to build in ListUtil.xs

*bump*

I havent been able to compile blead perl on win32 without patching it for
a month or 2 now.

+1
including the recently released 5.25.3.

Cheers,
Rob

@p5pRT
Copy link
Author

p5pRT commented Jul 28, 2016

From @tonycoz

On Thu Jul 14 09​:53​:22 2016, bulk88 wrote​:

On Wed Jul 13 21​:59​:53 2016, tonyc wrote​:

On Wed Jun 22 23​:58​:55 2016, bulk88 wrote​:

The core patch is unnecessary, I already submitted a patch to SLU
Dual-Life/Scalar-List-Utils#47 that
makes it ppport free

The problem is this makes Win32 an even more special snowflake than
it
needs to be - making it harder for CPAN upstream authors to maintain
their modules.

An alternative to my original patch is to clean up the differences
between the real-ppport.h and empty-ppport.h environments by adding
PERL_BCDVERSION to perl.h, as per the attached patch.

Tony

I dont remember the default include order for EUMM .c files, but
wouldn't first perl.h be included from installed CORE dir, then in the
.xs/.c, ppport.h is included, but the local tarballed ppport.h is
picked over the CORE one ( https://msdn.microsoft.com/en-
us/library/36k2cdd4.aspx ) because all CPAN modules that use ppport.h
are supposed to ship their own copy of it, which might be a very new
ppport.h or very old ppport.h?

Im thinking there will still be redefinition warnings between blead
perl.h and old ppport.h'es since old ppport.h'es wont have the ifndef
on their PERL_BCDVERSION.

I tested a CPAN XS module with ppport.h against the modified build
with no errors and no warnings. It was however MSVC.

A compiler *should* accept the redefinition which will occur between
perl.h and an older ppport.h, since redefining a macro with the same
sequence of tokens is explicitly legal in C89, C99 and C11.

That said, there is a risk that a compiler will produce noise on such
a redefinition, which makes my second patch less suitable.

For a cpan module to be in core, it already has special requirements
for its build process. It can't require XS code.

Why not? We can add dependencies between XS modules.

It can't require an
SQL server or 3rd party libs.

GDBM_File, DB_File depend on 3rd party libs.

It can't require root or a package
manager (Alien cough cough). Continuing to ban ppport.h in core makes
sense since many modules already do it with USE_PPPORT_H/_NOT_CORE, so
its not a special snowflake scenario. Simplifying the module
dependency tree is also good for all OSes to increase parallelism or
decrease the number of serial building points (bulk88 wont touch the
unix makefile, so bulk88 will never fix the false
Math​::BigInt​::FastCalc dep on List​::Utils, this is from the IRC convo
yesterday in #p5p).

Here is an idea, Im not 100% sure it is worthwhile to pursue. Im
thinking maybe the empty ppport.h should contain a "#error ppport.h
not available in core" instead of being empty. Greping /cpan shows all
modules except two guard against using ppport.h on blead with either
USE_PPPORT_H or _NOT_CORE macros. IPC-SysV and Win32API-File needs to
be fixed. Pathtools and Time​::HiRes in /dist also need fixing. There
are only 5 modules listed, one is SLU, in
http​://perl5.git.perl.org/perl.git/blob/HEAD​:/mkppport.lst . Getting
it to zero doesn't seem impossible. Then makeppport target from the
root makefiles, mkppport file and mkppport.lst file can be deleted
forever. Im not 100% sure putting a #error will solve anything,
because just adding USE_PPPORT_H or _NOT_CORE isn't a 100% guarantee
that the .xs file uses a ppport-only macro. Only looking at the code
throughly might show or make it standout that it used a ppport-only
macro. Also at a random point in the build, the #error ppport.h will
become the full ppport.h and it wont error anymore, covering up core
modules that use ppport.h when they shouldn't.

That might be a future change.

The "empty ppport.h design" already went through one round of "fix the
module" last year with
https://rt.cpan.org/Public/Bug/Display.html?id=102799
https://rt-archive.perl.org/perl5/Ticket/Display.html?id=123867
https://rt-archive.perl.org/perl5/Ticket/Display.html?id=125807
http​://www.nntp.perl.org/group/perl.perl5.porters/2016/02/msg234196.html

Yes, I remember that.

The issues raised and fixed while you did that work to make dmake
(which fed into the gmake changes) make me less happy to stay with the
empty ppport.h on Win32 [gd]make.

Unless p5p changes blead perl to NEVER install the full ppport.h in
installed CORE dir and if a CPAN on CPAN module does #include
"ppport.h", and didn't ship its own copy of ppport.h in its tarball,
someone can say its the module author's fault for relying on the
user's existing installed, random age, possibly medieval ppport.h. IDK
if this is true/right/opinions/etc.

That's only an issue if the compiler fails to build because of the redefinition, if it does fail to build it's not a C compiler.

I've applied my original patch that re-instates building ppport.h as
8657e86.

Tony

@p5pRT
Copy link
Author

p5pRT commented Jul 28, 2016

@tonycoz - Status changed from 'open' to 'pending release'

@p5pRT
Copy link
Author

p5pRT commented Jul 28, 2016

From @cpansprout

On Wed Jul 27 21​:47​:22 2016, tonyc wrote​:

On Thu Jul 14 09​:53​:22 2016, bulk88 wrote​:

For a cpan module to be in core, it already has special requirements
for its build process. It can't require XS code.

Why not? We can add dependencies between XS modules.

Aren’t all modules built with miniperl on Unix?

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jul 28, 2016

From @tonycoz

On Wed, Jul 27, 2016 at 10​:13​:26PM -0700, Father Chrysostomos via RT wrote​:

On Wed Jul 27 21​:47​:22 2016, tonyc wrote​:

On Thu Jul 14 09​:53​:22 2016, bulk88 wrote​:

For a cpan module to be in core, it already has special requirements
for its build process. It can't require XS code.

Why not? We can add dependencies between XS modules.

Aren’t all modules built with miniperl on Unix?

We have an (unneeded) dependency between Math​::BigInt​::FastCalc and
List​::Util, the module does need to have a pure-perl alternate
implementation too.

A dependency on the XS implementation probably wouldn't work, since
static builds would have circular dependencies, I think.

Tony

@p5pRT
Copy link
Author

p5pRT commented May 30, 2017

From @khwilliamson

Thank you for filing this report. You have helped make Perl better.

With the release today of Perl 5.26.0, this and 210 other issues have been
resolved.

Perl 5.26.0 may be downloaded via​:
https://metacpan.org/release/XSAWYERX/perl-5.26.0

If you find that the problem persists, feel free to reopen this ticket.

@p5pRT
Copy link
Author

p5pRT commented May 30, 2017

@khwilliamson - Status changed from 'pending release' to 'resolved'

@p5pRT p5pRT closed this as completed May 30, 2017
@p5pRT
Copy link
Author

p5pRT commented Feb 18, 2018

From @bulk88

On Wed, 27 Jul 2016 21​:47​:22 -0700, tonyc wrote​:

I've applied my original patch that re-instates building ppport.h as
8657e86.

Tony

In june 2016/july 2016 https​://perl5.git.perl.org/perl.git/8657e86b4fb3c8cf23a0c23b7093dda2e79b462b was commited which added back making a real ppport.h for win32 Perl. Around that time, I submitted https​://github.com/Dual-Life/Scalar-List-Utils/pull/47 but it took 6 months before the maintainer merged it (Dec 2016). That new SLU with the -DUSE_PPPORT_H was merged to blead in June 2017 https://perl5.git.perl.org/perl.git/5e99e069f583949fb8ac93b20100ac8054a66d3a so commit "(perl #128438) build ppport.h instead of using a dummy file" which was made as an emergency fix can now be reverted now . My problem with reinstating full ppport.h is now perl52*.dll is rebuilt/recompiled every time make is called on that dep.

I ran "C​:\perl521\src\win32>dmake -P2 CCTYPE=MSVC70 ..\perl527.dll" once then ran it again.


C​:\perl521\src\win32>dmake -P2 CCTYPE=MSVC70 ..\perl527.dll
..\miniperl.exe -I..\lib ..\mkppport
running "C​:\perl521\src\miniperl.exe" -I..\..\lib PPPort_pm.PL
including ppphdoc
including ppphbin
including version
including threads
including limits
including uv
including memory
including magic
including misc
including format
including mess
including variables
including mPUSH
including call
including newRV
including newCONSTSUB
including MY_CXT
including SvREFCNT
including newSV_type
including newSVpv
including SvPV
including Sv_set
including sv_xpvf
including shared_pv
including HvNAME
including gv
including warn
including pvs
including cop
including grok
including snprintf
including sprintf
including exception
including strlfuncs
including pv_tools
running "C​:\perl521\src\miniperl.exe" -I..\..\lib ppport_h.PL
ppport.h in cpan/DB_File is up-to-date
ppport.h in cpan/IPC-SysV is up-to-date
ppport.h in cpan/Scalar-List-Utils is up-to-date
ppport.h in cpan/Win32API-File is up-to-date
ppport.h in dist/PathTools is up-to-date
ppport.h in dist/Time-HiRes is up-to-date
removing temporary file PPPort.pm
removing temporary file ppport.h
..\miniperl.exe -I..\lib ..\make_ext.pl "MAKE=dmake" --dir=..\cpan --dir=..\dist
--dir=..\ext --static
..\miniperl.exe -I..\lib list_static_libs.pl > Extensions_static
link -dll -out​:..\perl527.dll -subsystem​:console -nologo -nodefaultlib -debug -o
pt​:ref,icf -ltcg -libpath​:"c​:\perl\lib\CORE" -machine
:x86 \
  @​Extensions_static \
  @​C​:\WINDOWS\TEMP\mk2
if exist ..\perl527.dll.manifest mt -nologo -manifest ..\perl527.dll.manifest -o
utputresource​:..\perl527.dll;2 && if exist ..\perl527.dll.manife
st del ..\perl527.dll.manifest
Generating code
Finished generating code

C​:\perl521\src\win32>


So working on core takes more time on rebuilds. If I revert "(perl #128438) build ppport.h instead of using a dummy file" perl52*.dll isn't rebuilt.


C​:\perl521\src\win32>gmake CCTYPE=MSVC70 ..\perl527.dll
..\miniperl.exe -I..\lib ..\make_ext.pl "MAKE=gmake" --dir=..\ext --dir=..\dist
--dynaloader lib
gmake[1]​: Entering directory 'C​:/perl521/src/dist/lib'
gmake[1]​: Leaving directory 'C​:/perl521/src/dist/lib'
gmake[1]​: Entering directory 'C​:/perl521/src/ext/DynaLoader'
gmake[1]​: Leaving directory 'C​:/perl521/src/ext/DynaLoader'

C​:\perl521\src\win32>


Problem is that psuedo target "MakePPPort" can't be satisfied on disk which means all dependents will reexecute/rebuild every time. The old way I had it with a fake ppport.h made libperl satisfiable on disk.

I think this ticket should be reopened. Or do I just submit a revert patch now that an updated SLU is in blead?

--
bulk88 ~ bulk88 at hotmail.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant