Skip Menu |

Date: Mon, 16 Apr 2018 17:45:36 +0000
Subject: [PATCH] fix version autodetect for Visual C 64bit edition
From: bulk 88 <bulk88 [...] hotmail.com>
To: "perlbug [...] perl.org" <perlbug [...] perl.org>
Download (untitled) / with headers
text/plain 4.6k
This is a bug report for perl from bulk88@hotmail.com, generated with the help of perlbug 1.41 running under perl 5.27.9. ----------------------------------------------------------------- [Please describe your issue here] I'll put the patch up separate bc spam filter. This is intended for 5.28. Maybe backport too. Maybe needs a perldelta entry too. 6th attempt to send bc spam filter. [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=core severity=low --- Site configuration information for perl 5.27.9: Configured by Administrator at Tue Jan 30 20:34:30 2018. Summary of my perl5 (revision 5 version 27 subversion 9) configuration: Platform: osname=MSWin32 osvers=5.2.3790 archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended useposix=true d_sigaction=undef useithreads=define usemultiplicity=define use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n default_inc_excludes_dot=define bincompat5005=undef Compiler: cc='cl' ccflags ='-nologo -GF -W3 -O1 -MD -Zi -DNDEBUG -GL -DWIN32 -D_CONSOLE -DNO_STRICT -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DWIN32_NO_REGISTRY' optimize='-O1 -MD -Zi -DNDEBUG -GL' cppflags='-DWIN32' ccversion='15.00.30729.01' gccversion='' gccosandvers='' intsize=4 longsize=4 ptrsize=4 doublesize=8 byteorder=1234 doublekind=3 d_longlong=undef longlongsize=8 d_longdbl=define longdblsize=8 longdblkind=0 ivtype='long' ivsize=4 nvtype='double' nvsize=8 Off_t='__int64' lseeksize=8 alignbytes=8 prototype=define Linker and Libraries: ld='link' ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -ltcg -libpath:"c:\perl\lib\CORE" -machine:x86' libpth="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib" libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib libc=msvcrt.lib so=dll useshrplib=true libperl=perl527.lib gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs dlext=dll d_dlsymun=undef ccdlflags=' ' cccdlflags=' ' lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -ltcg -libpath:"c:\perl\lib\CORE" -machine:x86' --- @INC for perl 5.27.9: lib C:/p527/srcnew/lib --- Environment for perl 5.27.9: CYGWIN=tty HOME (unset) LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH=/usr/lib/x86:/usr/X11R6/lib LOGDIR (unset) PATH=C:\WINDOWS\system32;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN;C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin;C:\Perl\bin;C:\WINDOWS;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE;C:\Program Files (x86)\Git\bin;C:\sp3220\c\bin; PERL_BADLANG (unset) SHELL (unset)
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 494b
On Mon, 16 Apr 2018 10:46:04 -0700, bulk88 wrote: Show quoted text
> This is a bug report for perl from bulk88@hotmail.com, > generated with the help of perlbug 1.41 running under perl 5.27.9. > > > ----------------------------------------------------------------- > [Please describe your issue here] > I'll put the patch up separate bc spam filter. This is intended for > 5.28. Maybe backport too. Maybe > needs a perldelta entry too. 6th attempt to send bc spam filter.
-- bulk88 ~ bulk88 at hotmail.com
Subject: 0001-fix-version-autodetect-for-Visual-C-64bit-edition.patch
>From 1d57d348b844ececc5abcece995a1e919a1288e2 Mon Sep 17 00:00:00 2001 From: Daniel Dragan <bulk88@hotmail.com> Date: Tue, 10 Apr 2018 17:36:19 -0400 Subject: [PATCH] fix version autodetect for Visual C 64bit edition -replace *= with := in makefile.mk because we dont want to run "gcc.exe -dumpmachine" multiple times -64 bit Visual C has the major version number at 1 "token" less than 32 bit edition, so the autodetect code was saying VC 2005 64b was CCTYPE="MSVC-60" because shell var %i was "00" in the "set /A", VC 2005 32b wasn't affected, MS when they created 64 bit VC took some liberties in changing the version string, rumor has it many legacy code bases do a string test for "80x86", so that is why it was never updated by MS. I think detect 64b VC ver num has been broken since day 1 of the autodetect code that I wrote in commit ca30c090c3 . I just nvr tested 64b before. -copy the info target from GNUMakefile to dmake mkf for debugging reasons, mostly so I can verify this revised autodetect logic works but since the target uses alot of CPU/IO/many procs launched 2 compute ver and many cmd.exes launched for all those echo line, dont by default execute info target from all target on dmake mkf to save build time. This also reduced diff-ness between the 2 mkfs. Maybe one day remove the info target from gmake mkf too, but not in this commit. --- win32/GNUmakefile | 11 +++++++++++ win32/makefile.mk | 39 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/win32/GNUmakefile b/win32/GNUmakefile index 9c89a98..f3695eb 100644 --- a/win32/GNUmakefile +++ b/win32/GNUmakefile @@ -348,11 +348,22 @@ GCCTARGET := $(shell $(GCCBIN) -dumpmachine 2>NUL) ifneq ($(GCCTARGET),) CCTYPE := GCC else +WIN64 := $(shell for /f "tokens=3 delims=.^ " \ + %%i in ('cl ^2^>^&1') do @if "%%i" == "32-bit" echo undef) +#major version of CL has diff position based on 32 vs 64 +#Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64 +#Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86 #use var to capture 1st line only, not 8th token of lines 2 & 3 in cl.exe output #rmving the cmd /c causes the var2b undef4echo but!4"set MSVCVER", cmd.exe bug? +ifeq ($(WIN64),undef) MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=8 delims=.^ " \ %%i in ('cl ^2^>^&1') do if not defined MSVCVER set /A "MSVCVER=%%i-6") \ & cmd /c echo %%MSVCVER%%) +else +MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=7 delims=.^ " \ + %%i in ('cl ^2^>^&1') do if not defined MSVCVER set /A "MSVCVER=%%i-6") \ + & cmd /c echo %%MSVCVER%%) +endif CCTYPE := MSVC$(MSVCVER)0 endif endif diff --git a/win32/makefile.mk b/win32/makefile.mk index 58cc579..7060988 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -348,14 +348,24 @@ BUILDOPT += -DWIN32_NO_REGISTRY #no explicit CCTYPE given, do auto detection .IF "$(CCTYPE)" == "" -GCCTARGET *= $(shell gcc -dumpmachine 2>NUL & exit /b 0) +GCCTARGET := $(shell gcc -dumpmachine 2>NUL & exit /b 0) #do we have a GCC? .IF "$(GCCTARGET)" != "" CCTYPE = GCC .ELSE +WIN64 := $(shell for /f "tokens=3 delims=.^ " \ + %i in ('cl ^2^>^&1') do @if "%i" == "32-bit" echo undef) +#major version of CL has diff position based on 32 vs 64 +#Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64 +#Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86 #use var to capture 1st line only, not 8th token of lines 2 & 3 in cl.exe output +.IF "$(WIN64)" == "undef" MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=8 delims=.^ " \ %i in ('cl ^2^>^&1') do @if not defined MSVCVER set /A "MSVCVER=%i-6")) +.ELSE +MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=7 delims=.^ " \ + %i in ('cl ^2^>^&1') do @if not defined MSVCVER set /A "MSVCVER=%i-6")) +.ENDIF CCTYPE := MSVC$(MSVCVER)0 .ENDIF .ENDIF @@ -523,7 +533,14 @@ BUILDOPT += -D__USE_MINGW_ANSI_STDIO MINIBUILDOPT += -D__USE_MINGW_ANSI_STDIO .ENDIF -GCCWRAPV *= $(shell 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)) +GCCVER1:= $(shell for /f "delims=. tokens=1,2,3" %i in ('gcc -dumpversion') do @echo %i) +GCCVER2:= $(shell for /f "delims=. tokens=1,2,3" %i in ('gcc -dumpversion') do @echo %j) +GCCVER3:= $(shell for /f "delims=. tokens=1,2,3" %i in ('gcc -dumpversion') do @echo %k) + +# If you are using GCC, 4.3 or later by default we add the -fwrapv option. +# See https://rt.perl.org/Ticket/Display.html?id=121505 +# +GCCWRAPV *= $(shell if "$(GCCVER1)"=="4" (if "$(GCCVER2)" geq "3" echo define) else if "$(GCCVER1)" geq "5" (echo define)) .IF "$(GCCWRAPV)" == "define" BUILDOPT += -fwrapv @@ -1139,6 +1156,24 @@ CFG_VARS = \ all : CHECKDMAKE rebasePE Extensions_nonxs $(PERLSTATIC) PostExt +info : + @echo # CCTYPE=$(CCTYPE) +.IF "$(CCTYPE)" == "GCC" + @echo # CC=$(CC) + @echo # GCCVER=$(GCCVER1).$(GCCVER2).$(GCCVER3) + @echo # GCCTARGET=$(GCCTARGET) + @echo # GCCCROSS=$(GCCCROSS) +.ENDIF + @echo # WIN64=$(WIN64) + @echo # ARCHITECTURE=$(ARCHITECTURE) + @echo # ARCHNAME=$(ARCHNAME) + @echo # MAKE=$(PLMAKE) +.IF "$(CCTYPE)" == "" + @echo Unable to detect gcc and/or architecture! + @exit 1 +.ENDIF + + ..\regcomp$(o) : ..\regnodes.h ..\regcharclass.h ..\regexec$(o) : ..\regnodes.h ..\regcharclass.h -- 2.5.0.windows.1
From: Steve Hay via perl5-porters <perl5-porters [...] perl.org>
Subject: Re: [perl #133117] [PATCH] fix version autodetect for Visual C 64bit edition
CC: perl5-porters [...] perl.org
To: Perl RT Bug Tracker <perlbug-followup [...] perl.org>
Date: Thu, 19 Apr 2018 13:54:29 +0100
Download (untitled) / with headers
text/plain 1.3k
On 16 April 2018 at 18:47, bulk88 via RT <perlbug-followup@perl.org> wrote: Show quoted text
> On Mon, 16 Apr 2018 10:46:04 -0700, bulk88 wrote:
>> This is a bug report for perl from bulk88@hotmail.com, >> generated with the help of perlbug 1.41 running under perl 5.27.9. >> >> >> ----------------------------------------------------------------- >> [Please describe your issue here] >> I'll put the patch up separate bc spam filter. This is intended for >> 5.28. Maybe backport too. Maybe >> needs a perldelta entry too. 6th attempt to send bc spam filter.
>
Thanks for the patch. However, there are still problems with recent versions of VC, which mean that the wrong CCTYPE is set for VC2015 and VC2017: - Probably for superstitious reasons (?!) Microsoft skipped version 13, so the next version after VC12 (in VS2013) is VC14 (in VS2015) rather than VC13. However, the version number output by cl.exe did NOT similarly skip a number, so from VC14 onwards we need to subtract 5 rather than 6 from the cl.exe version. - VS2017 contains VC14.1 rather than VC15. The CCTYPE in our makefiles is MSVC141. VS2010 contains VC10, cl.exe version 16. CCTYPE=MSVC100 VS2012 contains VC11, cl.exe version 17. CCTYPE=MSVC110 VS2013 contains VC12, cl.exe version 18. CCTYPE=MSVC120 VS2015 contains VC14, cl.exe version 19.00. CCTYPE=MSVC140 VS2017 contains VC14.1, cl.exe version 19.11. CCTYPE=MSVC141
Date: Sat, 14 Apr 2018 21:00:38 +0000
Subject: [PATCH] fix version autodetect for Visual C 64bit edition
From: bulk 88 <bulk88 [...] hotmail.com>
To: "perlbug [...] perl.org" <perlbug [...] perl.org>
Download (untitled) / with headers
text/plain 4.5k
This is a bug report for perl from bulk88@hotmail.com, generated with the help of perlbug 1.41 running under perl 5.27.9. ----------------------------------------------------------------- [Please describe your issue here] See attached patch. This is intended for 5.28. Maybe backport too. Maybe needs a perldelta entry too. 3rd attempt to send bc spam filter. Lets see if the attachment is caught or not this time. [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=core severity=low --- Site configuration information for perl 5.27.9: Configured by Administrator at Tue Jan 30 20:34:30 2018. Summary of my perl5 (revision 5 version 27 subversion 9) configuration: Platform: osname=MSWin32 osvers=5.2.3790 archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended useposix=true d_sigaction=undef useithreads=define usemultiplicity=define use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n default_inc_excludes_dot=define bincompat5005=undef Compiler: cc='cl' ccflags ='-nologo -GF -W3 -O1 -MD -Zi -DNDEBUG -GL -DWIN32 -D_CONSOLE -DNO_STRICT -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DWIN32_NO_REGISTRY' optimize='-O1 -MD -Zi -DNDEBUG -GL' cppflags='-DWIN32' ccversion='15.00.30729.01' gccversion='' gccosandvers='' intsize=4 longsize=4 ptrsize=4 doublesize=8 byteorder=1234 doublekind=3 d_longlong=undef longlongsize=8 d_longdbl=define longdblsize=8 longdblkind=0 ivtype='long' ivsize=4 nvtype='double' nvsize=8 Off_t='__int64' lseeksize=8 alignbytes=8 prototype=define Linker and Libraries: ld='link' ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -ltcg -libpath:"c:\perl\lib\CORE" -machine:x86' libpth="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib" libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib libc=msvcrt.lib so=dll useshrplib=true libperl=perl527.lib gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs dlext=dll d_dlsymun=undef ccdlflags=' ' cccdlflags=' ' lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -ltcg -libpath:"c:\perl\lib\CORE" -machine:x86' --- @INC for perl 5.27.9: lib C:/p527/srcnew/lib --- Environment for perl 5.27.9: CYGWIN=tty HOME (unset) LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH=/usr/lib/x86:/usr/X11R6/lib LOGDIR (unset) PATH=C:\WINDOWS\system32;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN;C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin;C:\Perl\bin;C:\WINDOWS;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE;C:\Program Files (x86)\Git\bin;C:\sp3220\c\bin; PERL_BADLANG (unset) SHELL (unset)

Message body is not shown because sender requested not to inline it.

To: perl5-porters [...] perl.org
Subject: Re: [perl #133126] [PATCH] fix version autodetect for Visual C 64bit edition
From: Dave Mitchell <davem [...] iabyn.com>
Date: Sat, 21 Apr 2018 15:38:45 +0100
Download (untitled) / with headers
text/plain 1.1k
On Thu, Apr 19, 2018 at 10:24:15PM -0700, bulk88 wrote: Show quoted text
> See attached patch. This is intended for 5.28. Maybe backport too. Maybe > needs a perldelta entry too. 3rd attempt to send bc spam filter. Lets > see if the attachment is caught or not this time.
The patch you attached appears to have been rot13'ed. For ease of other people reviewing, I've attached the decoded version here (along with CRLF -> LF conversion). Just as an aside, your commit message is very hard to read and comprehend, due to, amongst other things: - lack of paragraphs separated by a blank line; - gratuitous use of abbreviations, such as "nvr" for "never"; - terse prose; - lack of punctuation etc; - and more fundamentally, being written in a way which doesn't make it easy to understand what problem(s) are being addressed, and how they are being fixed. With better commit messages, you are likely to get quicker feedback from p5p members, and it will make it easier for future developers when trying to understand old commits. -- Little fly, thy summer's play my thoughtless hand has terminated with extreme prejudice. (with apologies to William Blake)

Message body is not shown because sender requested not to inline it.

To: perl5-porters [...] perl.org
Subject: Re: [perl #133126] [PATCH] fix version autodetect for Visual C 64bit edition
From: Dave Mitchell <davem [...] iabyn.com>
Date: Wed, 25 Apr 2018 11:46:51 +0100
Download (untitled) / with headers
text/plain 776b
On Sat, Apr 21, 2018 at 03:38:45PM +0100, Dave Mitchell wrote: Show quoted text
> On Thu, Apr 19, 2018 at 10:24:15PM -0700, bulk88 wrote:
> > See attached patch. This is intended for 5.28. Maybe backport too. Maybe > > needs a perldelta entry too. 3rd attempt to send bc spam filter. Lets > > see if the attachment is caught or not this time.
> > The patch you attached appears to have been rot13'ed. > > For ease of other people reviewing, I've attached the decoded version > here (along with CRLF -> LF conversion).
I can't tell from the patch description whether this is a critical build fix which needs to going into 5.28 despite the full code freeze, or just some 'nice to have' that can wait till 5.29. Can you clarify, thanks. -- Standards (n). Battle insignia or tribal totems.
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 912b
On Wed, 25 Apr 2018 03:47:05 -0700, davem wrote: Show quoted text
> On Sat, Apr 21, 2018 at 03:38:45PM +0100, Dave Mitchell wrote:
> > On Thu, Apr 19, 2018 at 10:24:15PM -0700, bulk88 wrote:
> > > See attached patch. This is intended for 5.28. Maybe backport too. Maybe > > > needs a perldelta entry too. 3rd attempt to send bc spam filter. Lets > > > see if the attachment is caught or not this time.
> > > > The patch you attached appears to have been rot13'ed. > > > > For ease of other people reviewing, I've attached the decoded version > > here (along with CRLF -> LF conversion).
> > I can't tell from the patch description whether this is a critical > build fix which needs to going into 5.28 despite the full code freeze, > or just some 'nice to have' that can wait till 5.29. > > Can you clarify, thanks. >
This is a dupe of https://rt.perl.org/Ticket/Display.html?id=133117 . -- bulk88 ~ bulk88 at hotmail.com
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.1k
On Thu, 19 Apr 2018 05:54:49 -0700, shay wrote: Show quoted text
> Thanks for the patch. However, there are still problems with recent > versions of VC, which mean that the wrong CCTYPE is set for VC2015 and > VC2017: > > - Probably for superstitious reasons (?!) Microsoft skipped version > 13, so the next version after VC12 (in VS2013) is VC14 (in VS2015) > rather than VC13. However, the version number output by cl.exe did NOT > similarly skip a number, so from VC14 onwards we need to subtract 5 > rather than 6 from the cl.exe version. > > - VS2017 contains VC14.1 rather than VC15. The CCTYPE in our makefiles > is MSVC141. > > VS2010 contains VC10, cl.exe version 16. CCTYPE=MSVC100 > VS2012 contains VC11, cl.exe version 17. CCTYPE=MSVC110 > VS2013 contains VC12, cl.exe version 18. CCTYPE=MSVC120 > VS2015 contains VC14, cl.exe version 19.00. CCTYPE=MSVC140 > VS2017 contains VC14.1, cl.exe version 19.11. CCTYPE=MSVC141
I've revised the patch description because of comments in https://rt.perl.org/Ticket/Display.html?id=133126 and I added code to deal with VC 2015 and VC 2017 but I can't test it on a real VC 2015/2017. Test it please. -- bulk88 ~ bulk88 at hotmail.com
Subject: 0001-fix-version-autodetect-for-Visual-C-64bit-edition.patch
From 655ae589ae490029e5f118ecaf690f0a3de49468 Mon Sep 17 00:00:00 2001 From: Daniel Dragan <bulk88@hotmail.com> Date: Thu, 26 Apr 2018 00:14:08 -0400 Subject: [PATCH] fix version autodetect for Visual C 64bit edition -replace *= with := in makefile.mk because we dont want to run "gcc.exe -dumpmachine" multiple times -64 bit Visual C has the major version number at 1 "token" less than 32 bit edition, so the autodetect code was saying VC 2005 64b was CCTYPE="MSVC-60" because shell var %i was "00" in the "set /A", VC 2005 32b wasn't affected, MS when they created 64 bit VC took some liberties in changing the version string, rumor has it many legacy code bases do a string test for "80x86", so that is why it was never updated by MS. I think detecting 64b VC version numbers has been broken since day 1 of the autodetect code that I wrote in commit ca30c090c3 . I just never tested it on 64b before. -copy the "info" target from GNUMakefile to makefile.mk for debugging reasons, mostly so I can verify this revised autodetect logic works but since the target uses alot of CPU/IO/many procs launched to compute the version and many cmd.exes are launched for all those echo line, dont by default execute the "info" target from "all" target on dmake makefile.mk to save build time. Copying "info" target also reduces diff-ness between the 2 makefiles. Maybe one day remove running the info target by dafault on a target "all" from GNUmakefile too, but not in this commit. -consolidate the recipe lines for "info" target so less cmd.exe procs are launched by the make tools, unroll echo CCTYPE into both branches. For me with dmake, the "info" targets execution time went from 398ms to 141 ms -there was a skip of "VC" version vs "cl.exe" version between VC 2013 aka VC 12 and VC 2015 aka VC 14, so at cl.exe ver 19 the skip must be accounted for, also starting in VC 2017, the MINOR version number started being relevent since MS stopped ticking up the MAJOR version number so take the "X" from AB.XY.CD.EF and append it to the version number, the 2nd number in "tokens" sets %j var to be that number, but dont look at minor number for older VCs since the only old "AB.10" VC compiler, which is VC 2003 aka 7.10 and VC 2002 aka 7.00 are treated identically and combined to 7.00 for perl purposes --- win32/GNUmakefile | 47 +++++++++++++++++++++++++++++++++-------------- win32/makefile.mk | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 83 insertions(+), 19 deletions(-) diff --git a/win32/GNUmakefile b/win32/GNUmakefile index c41869a..01f61c4 100644 --- a/win32/GNUmakefile +++ b/win32/GNUmakefile @@ -348,12 +348,25 @@ GCCTARGET := $(shell $(GCCBIN) -dumpmachine 2>NUL) ifneq ($(GCCTARGET),) CCTYPE := GCC else +WIN64 := $(shell for /f "tokens=3 delims=.^ " \ + %%i in ('cl ^2^>^&1') do @if "%%i" == "32-bit" echo undef) +#major version of CL has diff position based on 32 vs 64 +#Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64 +#Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86 #use var to capture 1st line only, not 8th token of lines 2 & 3 in cl.exe output #rmving the cmd /c causes the var2b undef4echo but!4"set MSVCVER", cmd.exe bug? -MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=8 delims=.^ " \ - %%i in ('cl ^2^>^&1') do if not defined MSVCVER set /A "MSVCVER=%%i-6") \ - & cmd /c echo %%MSVCVER%%) -CCTYPE := MSVC$(MSVCVER)0 +ifeq ($(WIN64),undef) +MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=8,9 delims=.^ " \ + %%i in ('cl ^2^>^&1') do if not defined MSVCVER if %%i%% geq 19 \ + (set /A "MSVCVER=((%%i-5)*10)+(%%j/10)") \ + else (set /A "MSVCVER=(%%i-6)*10")) & cmd /c echo %%MSVCVER%%) +else +MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=7,8 delims=.^ " \ + %%i in ('cl ^2^>^&1') do if not defined MSVCVER if %%i%% geq 19 \ + (set /A "MSVCVER=((%%i-5)*10)+(%%j/10)") \ + else (set /A "MSVCVER=(%%i-6)*10")) & cmd /c echo %%MSVCVER%%) +endif +CCTYPE := MSVC$(MSVCVER) endif endif @@ -1170,17 +1183,23 @@ CFG_VARS = \ all : info rebasePE Extensions_nonxs $(PERLSTATIC) PostExt info : - @echo # CCTYPE=$(CCTYPE) ifeq ($(CCTYPE),GCC) - @echo # GCCBIN=$(GCCBIN) - @echo # GCCVER=$(GCCVER1).$(GCCVER2).$(GCCVER3) - @echo # GCCTARGET=$(GCCTARGET) - @echo # GCCCROSS=$(GCCCROSS) -endif - @echo # WIN64=$(WIN64) - @echo # ARCHITECTURE=$(ARCHITECTURE) - @echo # ARCHNAME=$(ARCHNAME) - @echo # MAKE=$(PLMAKE) + @echo # CCTYPE=$(CCTYPE)&& \ + echo # GCCBIN=$(GCCBIN)&& \ + echo # GCCVER=$(GCCVER1).$(GCCVER2).$(GCCVER3)&& \ + echo # GCCTARGET=$(GCCTARGET)&& \ + echo # GCCCROSS=$(GCCCROSS)&& \ + echo # WIN64=$(WIN64)&& \ + echo # ARCHITECTURE=$(ARCHITECTURE)&& \ + echo # ARCHNAME=$(ARCHNAME)&& \ + echo # MAKE=$(PLMAKE) +else + @echo # CCTYPE=$(CCTYPE)&& \ + echo # WIN64=$(WIN64)&& \ + echo # ARCHITECTURE=$(ARCHITECTURE)&& \ + echo # ARCHNAME=$(ARCHNAME)&& \ + echo # MAKE=$(PLMAKE) +endif ifeq ($(CCTYPE),) @echo Unable to detect gcc and/or architecture! @exit 1 diff --git a/win32/makefile.mk b/win32/makefile.mk index 74d6e04..f36fdee 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -348,15 +348,29 @@ BUILDOPT += -DWIN32_NO_REGISTRY #no explicit CCTYPE given, do auto detection .IF "$(CCTYPE)" == "" -GCCTARGET *= $(shell gcc -dumpmachine 2>NUL & exit /b 0) +GCCTARGET := $(shell gcc -dumpmachine 2>NUL & exit /b 0) #do we have a GCC? .IF "$(GCCTARGET)" != "" CCTYPE = GCC .ELSE +WIN64 := $(shell for /f "tokens=3 delims=.^ " \ + %i in ('cl ^2^>^&1') do @if "%i" == "32-bit" echo undef) +#major version of CL has diff position based on 32 vs 64 +#Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64 +#Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86 #use var to capture 1st line only, not 8th token of lines 2 & 3 in cl.exe output -MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=8 delims=.^ " \ - %i in ('cl ^2^>^&1') do @if not defined MSVCVER set /A "MSVCVER=%i-6")) -CCTYPE := MSVC$(MSVCVER)0 +.IF "$(WIN64)" == "undef" +MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=8,9 delims=.^ " \ + %i in ('cl ^2^>^&1') do @if not defined MSVCVER if %i% geq 19 \ + (set /A "MSVCVER=((%i-5)*10)+(%j/10)") \ + else (set /A "MSVCVER=(%i-6)*10"))) +.ELSE +MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=7,8 delims=.^ " \ + %i in ('cl ^2^>^&1') do @if not defined MSVCVER if %i% geq 19 \ + (set /A "MSVCVER=((%i-5)*10)+(%j/10)") \ + else (set /A "MSVCVER=(%i-6)*10"))) +.ENDIF +CCTYPE := MSVC$(MSVCVER) .ENDIF .ENDIF @@ -523,7 +537,14 @@ BUILDOPT += -D__USE_MINGW_ANSI_STDIO MINIBUILDOPT += -D__USE_MINGW_ANSI_STDIO .ENDIF -GCCWRAPV *= $(shell 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)) +GCCVER1:= $(shell for /f "delims=. tokens=1,2,3" %i in ('gcc -dumpversion') do @echo %i) +GCCVER2:= $(shell for /f "delims=. tokens=1,2,3" %i in ('gcc -dumpversion') do @echo %j) +GCCVER3:= $(shell for /f "delims=. tokens=1,2,3" %i in ('gcc -dumpversion') do @echo %k) + +# If you are using GCC, 4.3 or later by default we add the -fwrapv option. +# See https://rt.perl.org/Ticket/Display.html?id=121505 +# +GCCWRAPV *= $(shell if "$(GCCVER1)"=="4" (if "$(GCCVER2)" geq "3" echo define) else if "$(GCCVER1)" geq "5" (echo define)) .IF "$(GCCWRAPV)" == "define" BUILDOPT += -fwrapv @@ -1140,6 +1161,30 @@ CFG_VARS = \ all : CHECKDMAKE rebasePE Extensions_nonxs $(PERLSTATIC) PostExt +info : +.IF "$(CCTYPE)" == "GCC" + @echo # CCTYPE=$(CCTYPE)&& \ + echo # CC=$(CC)&& \ + echo # GCCVER=$(GCCVER1).$(GCCVER2).$(GCCVER3)&& \ + echo # GCCTARGET=$(GCCTARGET)&& \ + echo # GCCCROSS=$(GCCCROSS)&& \ + echo # WIN64=$(WIN64)&& \ + echo # ARCHITECTURE=$(ARCHITECTURE)&& \ + echo # ARCHNAME=$(ARCHNAME)&& \ + echo # MAKE=$(PLMAKE) +.ELSE + @echo # CCTYPE=$(CCTYPE)&& \ + echo # WIN64=$(WIN64)&& \ + echo # ARCHITECTURE=$(ARCHITECTURE)&& \ + echo # ARCHNAME=$(ARCHNAME)&& \ + echo # MAKE=$(PLMAKE) +.ENDIF +.IF "$(CCTYPE)" == "" + @echo Unable to detect gcc and/or architecture! + @exit 1 +.ENDIF + + ..\regcomp$(o) : ..\regnodes.h ..\regcharclass.h ..\regexec$(o) : ..\regnodes.h ..\regcharclass.h -- 2.5.0.windows.1
Date: Wed, 25 Apr 2018 22:35:40 -0600
To: perlbug-followup [...] perl.org
From: Karl Williamson <public [...] khwilliamson.com>
Subject: Re: [perl #133126] [PATCH] fix version autodetect for Visual C 64bit edition
CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 948b
On 04/25/2018 10:12 PM, bulk88 via RT wrote: Show quoted text
> On Wed, 25 Apr 2018 03:47:05 -0700, davem wrote:
>> On Sat, Apr 21, 2018 at 03:38:45PM +0100, Dave Mitchell wrote:
>>> On Thu, Apr 19, 2018 at 10:24:15PM -0700, bulk88 wrote:
>>>> See attached patch. This is intended for 5.28. Maybe backport too. Maybe >>>> needs a perldelta entry too. 3rd attempt to send bc spam filter. Lets >>>> see if the attachment is caught or not this time.
>>> >>> The patch you attached appears to have been rot13'ed. >>> >>> For ease of other people reviewing, I've attached the decoded version >>> here (along with CRLF -> LF conversion).
>> >> I can't tell from the patch description whether this is a critical >> build fix which needs to going into 5.28 despite the full code freeze, >> or just some 'nice to have' that can wait till 5.29. >> >> Can you clarify, thanks. >>
> > This is a dupe of https://rt.perl.org/Ticket/Display.html?id=133117 . >
merged into that
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 444b
On Wed, 25 Apr 2018 21:15:27 -0700, bulk88 wrote: Show quoted text
> I've revised the patch description because of comments in > https://rt.perl.org/Ticket/Display.html?id=133126 and I added code to > deal with VC 2015 and VC 2017 but I can't test it on a real VC > 2015/2017. Test it please.
Patch revised again, I fixed the bug that "make info" without ANY compiler in PATH didn't print the error message in "info" target. -- bulk88 ~ bulk88 at hotmail.com
Subject: 0001-fix-version-autodetect-for-Visual-C-64bit-edition.patch
From d3424bc9f91646e06c7e1d4ef48533383e05c1a4 Mon Sep 17 00:00:00 2001 From: Daniel Dragan <bulk88@hotmail.com> Date: Thu, 26 Apr 2018 01:03:01 -0400 Subject: [PATCH] fix version autodetect for Visual C 64bit edition -replace *= with := in makefile.mk because we dont want to run "gcc.exe -dumpmachine" multiple times -64 bit Visual C has the major version number at 1 "token" less than 32 bit edition, so the autodetect code was saying VC 2005 64b was CCTYPE="MSVC-60" because shell var %i was "00" in the "set /A", VC 2005 32b wasn't affected, MS when they created 64 bit VC took some liberties in changing the version string, rumor has it many legacy code bases do a string test for "80x86", so that is why it was never updated by MS. I think detecting 64b VC version numbers has been broken since day 1 of the autodetect code that I wrote in commit ca30c090c3 . I just never tested it on 64b before. -copy the "info" target from GNUMakefile to makefile.mk for debugging reasons, mostly so I can verify this revised autodetect logic works but since the target uses alot of CPU/IO/many procs launched to compute the version and many cmd.exes are launched for all those echo line, dont by default execute the "info" target from "all" target on dmake makefile.mk to save build time. Copying "info" target also reduces diff-ness between the 2 makefiles. Maybe one day remove running the info target by dafault on a target "all" from GNUmakefile too, but not in this commit. -consolidate the recipe lines for "info" target so less cmd.exe procs are launched by the make tools, unroll echo CCTYPE into both branches. For me with dmake, the "info" targets execution time went from 398ms to 141 ms -there was a skip of "VC" version vs "cl.exe" version between VC 2013 aka VC 12 and VC 2015 aka VC 14, so at cl.exe ver 19 the skip must be accounted for, also starting in VC 2017, the MINOR version number started being relevent since MS stopped ticking up the MAJOR version number so take the "X" from AB.XY.CD.EF and append it to the version number, the 2nd number in "tokens" sets %j var to be that number, but dont look at minor number for older VCs since the only old "AB.10" VC compiler, which is VC 2003 aka 7.10 and VC 2002 aka 7.00 are treated identically and combined to 7.00 for perl purposes -fixed a bug that a console without gcc and without vc in the PATH autodetected to a gibberish MSVC version instead of erroring to the user --- win32/GNUmakefile | 52 ++++++++++++++++++++++++++++++++++------------- win32/makefile.mk | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 93 insertions(+), 19 deletions(-) diff --git a/win32/GNUmakefile b/win32/GNUmakefile index a81face..de34db2 100644 --- a/win32/GNUmakefile +++ b/win32/GNUmakefile @@ -353,12 +353,30 @@ GCCTARGET := $(shell $(GCCBIN) -dumpmachine 2>NUL) ifneq ($(GCCTARGET),) CCTYPE := GCC else +WIN64 := $(shell for /f "tokens=3 delims=.^ " \ + %%i in ('cl ^2^>^&1') do @if "%%i" == "32-bit" echo undef) +#major version of CL has diff position based on 32 vs 64 +#Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64 +#Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86 #use var to capture 1st line only, not 8th token of lines 2 & 3 in cl.exe output #rmving the cmd /c causes the var2b undef4echo but!4"set MSVCVER", cmd.exe bug? -MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=8 delims=.^ " \ - %%i in ('cl ^2^>^&1') do if not defined MSVCVER set /A "MSVCVER=%%i-6") \ - & cmd /c echo %%MSVCVER%%) -CCTYPE := MSVC$(MSVCVER)0 +ifeq ($(WIN64),undef) +MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=8,9 delims=.^ " \ + %%i in ('cl ^2^>^&1') do if not defined MSVCVER if %%i%% geq 19 \ + (set /A "MSVCVER=((%%i-5)*10)+(%%j/10)") \ + else (set /A "MSVCVER=(%%i-6)*10")) & cmd /c echo %%MSVCVER%%) +else +MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=7,8 delims=.^ " \ + %%i in ('cl ^2^>^&1') do if not defined MSVCVER if %%i%% geq 19 \ + (set /A "MSVCVER=((%%i-5)*10)+(%%j/10)") \ + else (set /A "MSVCVER=(%%i-6)*10")) & cmd /c echo %%MSVCVER%%) +endif +#autodetect failed, reset to empty string +ifeq ($(MSVCVER),-50) +CCTYPE := +else +CCTYPE := MSVC$(MSVCVER) +endif endif endif @@ -1178,17 +1196,23 @@ CFG_VARS = \ all : info rebasePE Extensions_nonxs $(PERLSTATIC) PostExt info : - @echo # CCTYPE=$(CCTYPE) ifeq ($(CCTYPE),GCC) - @echo # GCCBIN=$(GCCBIN) - @echo # GCCVER=$(GCCVER1).$(GCCVER2).$(GCCVER3) - @echo # GCCTARGET=$(GCCTARGET) - @echo # GCCCROSS=$(GCCCROSS) -endif - @echo # WIN64=$(WIN64) - @echo # ARCHITECTURE=$(ARCHITECTURE) - @echo # ARCHNAME=$(ARCHNAME) - @echo # MAKE=$(PLMAKE) + @echo # CCTYPE=$(CCTYPE)&& \ + echo # GCCBIN=$(GCCBIN)&& \ + echo # GCCVER=$(GCCVER1).$(GCCVER2).$(GCCVER3)&& \ + echo # GCCTARGET=$(GCCTARGET)&& \ + echo # GCCCROSS=$(GCCCROSS)&& \ + echo # WIN64=$(WIN64)&& \ + echo # ARCHITECTURE=$(ARCHITECTURE)&& \ + echo # ARCHNAME=$(ARCHNAME)&& \ + echo # MAKE=$(PLMAKE) +else + @echo # CCTYPE=$(CCTYPE)&& \ + echo # WIN64=$(WIN64)&& \ + echo # ARCHITECTURE=$(ARCHITECTURE)&& \ + echo # ARCHNAME=$(ARCHNAME)&& \ + echo # MAKE=$(PLMAKE) +endif ifeq ($(CCTYPE),) @echo Unable to detect gcc and/or architecture! @exit 1 diff --git a/win32/makefile.mk b/win32/makefile.mk index 0daeb79..be8c4b5 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -348,15 +348,34 @@ BUILDOPT += -DWIN32_NO_REGISTRY #no explicit CCTYPE given, do auto detection .IF "$(CCTYPE)" == "" -GCCTARGET *= $(shell gcc -dumpmachine 2>NUL & exit /b 0) +GCCTARGET := $(shell gcc -dumpmachine 2>NUL & exit /b 0) #do we have a GCC? .IF "$(GCCTARGET)" != "" CCTYPE = GCC .ELSE +WIN64 := $(shell for /f "tokens=3 delims=.^ " \ + %i in ('cl ^2^>^&1') do @if "%i" == "32-bit" echo undef) +#major version of CL has diff position based on 32 vs 64 +#Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64 +#Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86 #use var to capture 1st line only, not 8th token of lines 2 & 3 in cl.exe output -MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=8 delims=.^ " \ - %i in ('cl ^2^>^&1') do @if not defined MSVCVER set /A "MSVCVER=%i-6")) -CCTYPE := MSVC$(MSVCVER)0 +.IF "$(WIN64)" == "undef" +MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=8,9 delims=.^ " \ + %i in ('cl ^2^>^&1') do @if not defined MSVCVER if %i% geq 19 \ + (set /A "MSVCVER=((%i-5)*10)+(%j/10)") \ + else (set /A "MSVCVER=(%i-6)*10"))) +.ELSE +MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=7,8 delims=.^ " \ + %i in ('cl ^2^>^&1') do @if not defined MSVCVER if %i% geq 19 \ + (set /A "MSVCVER=((%i-5)*10)+(%j/10)") \ + else (set /A "MSVCVER=(%i-6)*10"))) +.ENDIF +#autodetect failed, reset to empty string +.IF "$(MSVCVER)" == "-50" +CCTYPE := +.ELSE +CCTYPE := MSVC$(MSVCVER) +.ENDIF .ENDIF .ENDIF @@ -523,7 +542,14 @@ BUILDOPT += -D__USE_MINGW_ANSI_STDIO MINIBUILDOPT += -D__USE_MINGW_ANSI_STDIO .ENDIF -GCCWRAPV *= $(shell 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)) +GCCVER1:= $(shell for /f "delims=. tokens=1,2,3" %i in ('gcc -dumpversion') do @echo %i) +GCCVER2:= $(shell for /f "delims=. tokens=1,2,3" %i in ('gcc -dumpversion') do @echo %j) +GCCVER3:= $(shell for /f "delims=. tokens=1,2,3" %i in ('gcc -dumpversion') do @echo %k) + +# If you are using GCC, 4.3 or later by default we add the -fwrapv option. +# See https://rt.perl.org/Ticket/Display.html?id=121505 +# +GCCWRAPV *= $(shell if "$(GCCVER1)"=="4" (if "$(GCCVER2)" geq "3" echo define) else if "$(GCCVER1)" geq "5" (echo define)) .IF "$(GCCWRAPV)" == "define" BUILDOPT += -fwrapv @@ -1140,6 +1166,30 @@ CFG_VARS = \ all : CHECKDMAKE rebasePE Extensions_nonxs $(PERLSTATIC) PostExt +info : +.IF "$(CCTYPE)" == "GCC" + @echo # CCTYPE=$(CCTYPE)&& \ + echo # CC=$(CC)&& \ + echo # GCCVER=$(GCCVER1).$(GCCVER2).$(GCCVER3)&& \ + echo # GCCTARGET=$(GCCTARGET)&& \ + echo # GCCCROSS=$(GCCCROSS)&& \ + echo # WIN64=$(WIN64)&& \ + echo # ARCHITECTURE=$(ARCHITECTURE)&& \ + echo # ARCHNAME=$(ARCHNAME)&& \ + echo # MAKE=$(PLMAKE) +.ELSE + @echo # CCTYPE=$(CCTYPE)&& \ + echo # WIN64=$(WIN64)&& \ + echo # ARCHITECTURE=$(ARCHITECTURE)&& \ + echo # ARCHNAME=$(ARCHNAME)&& \ + echo # MAKE=$(PLMAKE) +.ENDIF +.IF "$(CCTYPE)" == "" + @echo Unable to detect gcc and/or architecture! + @exit 1 +.ENDIF + + ..\regcomp$(o) : ..\regnodes.h ..\regcharclass.h ..\regexec$(o) : ..\regnodes.h ..\regcharclass.h -- 2.5.0.windows.1
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 689b
On Wed, 25 Apr 2018 03:47:05 -0700, davem wrote: Show quoted text
> I can't tell from the patch description whether this is a critical > build fix which needs to going into 5.28 despite the full code freeze, > or just some 'nice to have' that can wait till 5.29. > > Can you clarify, thanks.
I dont care that much if its in 5.28.0 at this point. If its appropriate for 5.28.1 as a build fix (needs more testing from community), then it is appropriate. Its a bug fix for a bug that has been since day 1 of the code without complaints from anyone else. The build still works if you set all the info manually like everyone did since the Win32 perl port started years ago. -- bulk88 ~ bulk88 at hotmail.com
To: bulk88 via RT <perlbug-followup [...] perl.org>
CC: perl5-porters [...] perl.org
Subject: Re: [perl #133117] [PATCH] fix version autodetect for Visual C 64bit edition
From: Dave Mitchell <davem [...] iabyn.com>
Date: Sat, 28 Apr 2018 10:47:17 +0100
Download (untitled) / with headers
text/plain 383b
On Wed, Apr 25, 2018 at 10:21:07PM -0700, bulk88 via RT wrote: Show quoted text
> I dont care that much if its in 5.28.0 at this point.
Ok, I'll remove from the blockers list. -- More than any other time in history, mankind faces a crossroads. One path leads to despair and utter hopelessness. The other, to total extinction. Let us pray we have the wisdom to choose correctly. -- Woody Allen
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.3k
On Wed, 25 Apr 2018 22:16:43 -0700, bulk88 wrote: Show quoted text
> On Wed, 25 Apr 2018 21:15:27 -0700, bulk88 wrote:
> > I've revised the patch description because of comments in > > https://rt.perl.org/Ticket/Display.html?id=133126 and I added code to > > deal with VC 2015 and VC 2017 but I can't test it on a real VC > > 2015/2017. Test it please.
> > Patch revised again, I fixed the bug that "make info" without ANY > compiler in PATH didn't print the error message in "info" target.
Please could you expand the following comment (in GNUmakefile) into more intelligible English?: #rmving the cmd /c causes the var2b undef4echo but!4"set MSVCVER", cmd.exe bug? (or just remove it? - it isn't in the equivalent section of code in makefile.mk). Testing - I get slightly different output from the info target when using gmake vs dmake with gcc compilers - the dmake output is missing GCCTARGET (e.g. with mingw-w64.org 7.1.0 x86): C:\Dev\Git\perl\win32>gmake info # CCTYPE=GCC # GCCBIN=gcc # GCCVER=7.1.0 # GCCTARGET=i686-w64-mingw32 # GCCCROSS= # WIN64=undef # ARCHITECTURE=x86 # ARCHNAME=MSWin32-x86-multi-thread # MAKE=gmake C:\Dev\Git\perl\win32>dmake info # CCTYPE=GCC # CC=gcc # GCCVER=7.1.0 # GCCTARGET= # GCCCROSS= # WIN64=undef # ARCHITECTURE=x86 # ARCHNAME=MSWin32-x86-multi-thread # MAKE=dmake Otherwise this is looking good - tested with several gccs (mingw.org and mingw-w64.org), VC6 x86 and VC10/11/12/14/141 x86/x64.
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.7k
On Tue, 10 Jul 2018 06:00:45 -0700, shay wrote: Show quoted text
> Please could you expand the following comment (in GNUmakefile) into > more intelligible English?: > > #rmving the cmd /c causes the var2b undef4echo but!4"set MSVCVER", > cmd.exe bug? > > (or just remove it? - it isn't in the equivalent section of code in > makefile.mk).
No, without that cmd /c the makefile var is empty string or undef but only for gmake. The extra cmd /c isn't needed for dmake. IDK y. Show quoted text
> Testing - I get slightly different output from the info target when > using gmake vs dmake with gcc compilers - the dmake output is missing > GCCTARGET (e.g. with mingw-w64.org 7.1.0 x86): > > C:\Dev\Git\perl\win32>gmake info > # CCTYPE=GCC > # GCCBIN=gcc > # GCCVER=7.1.0 > # GCCTARGET=i686-w64-mingw32 > # GCCCROSS= > # WIN64=undef > # ARCHITECTURE=x86 > # ARCHNAME=MSWin32-x86-multi-thread > # MAKE=gmake > > C:\Dev\Git\perl\win32>dmake info > # CCTYPE=GCC > # CC=gcc > # GCCVER=7.1.0 > # GCCTARGET= > # GCCCROSS= > # WIN64=undef > # ARCHITECTURE=x86 > # ARCHNAME=MSWin32-x86-multi-thread > # MAKE=dmake > > Otherwise this is looking good - tested with several gccs (mingw.org > and mingw-w64.org), VC6 x86 and VC10/11/12/14/141 x86/x64.
Can you retry the latest patch for GCCTARGET var? For me GCCTARGET is identical between dmake and gmake ------------------------------- C:\perl528\srcnew\win32>gmake info # CCTYPE=GCC # GCCBIN=gcc # GCCVER=4.9.2 # GCCTARGET=i686-w64-mingw32 # GCCCROSS= # WIN64=undef # ARCHITECTURE=x86 # ARCHNAME=MSWin32-x86-multi-thread # MAKE=gmake C:\perl528\srcnew\win32>dmake info # CCTYPE=GCC # CC=gcc # GCCVER=4.9.2 # GCCTARGET=i686-w64-mingw32 # GCCCROSS= # WIN64=undef # ARCHITECTURE=x86 # ARCHNAME=MSWin32-x86-multi-thread # MAKE=dmake C:\perl528\srcnew\win32> ----------------------------- -- bulk88 ~ bulk88 at hotmail.com
Subject: 0001-fix-version-autodetect-for-Visual-C-64bit-edition.patch
From 9c174314f2bacdb818f7ac8c18bc8be948d3c2ff Mon Sep 17 00:00:00 2001 From: Daniel Dragan <bulk88@hotmail.com> Date: Fri, 27 Jul 2018 16:44:26 -0400 Subject: [PATCH] fix version autodetect for Visual C 64bit edition -replace *= with := in makefile.mk because we dont want to run "gcc.exe -dumpmachine" multiple times -64 bit Visual C has the major version number at 1 "token" less than 32 bit edition, so the autodetect code was saying VC 2005 64b was CCTYPE="MSVC-60" because shell var %i was "00" in the "set /A", VC 2005 32b wasn't affected, MS when they created 64 bit VC took some liberties in changing the version string, rumor has it many legacy code bases do a string test for "80x86", so that is why it was never updated by MS. I think detecting 64b VC version numbers has been broken since day 1 of the autodetect code that I wrote in commit ca30c090c3 . I just never tested it on 64b before. -copy the "info" target from GNUMakefile to makefile.mk for debugging reasons, mostly so I can verify this revised autodetect logic works but since the target uses alot of CPU/IO/many procs launched to compute the version and many cmd.exes are launched for all those echo line, dont by default execute the "info" target from "all" target on dmake makefile.mk to save build time. Copying "info" target also reduces diff-ness between the 2 makefiles. Maybe one day remove running the info target by dafault on a target "all" from GNUmakefile too, but not in this commit. -consolidate the recipe lines for "info" target so less cmd.exe procs are launched by the make tools, unroll echo CCTYPE into both branches. For me with dmake, the "info" targets execution time went from 398ms to 141 ms -there was a skip of "VC" version vs "cl.exe" version between VC 2013 aka VC 12 and VC 2015 aka VC 14, so at cl.exe ver 19 the skip must be accounted for, also starting in VC 2017, the MINOR version number started being relevent since MS stopped ticking up the MAJOR version number so take the "X" from AB.XY.CD.EF and append it to the version number, the 2nd number in "tokens" sets %j var to be that number, but dont look at minor number for older VCs since the only old "AB.10" VC compiler, which is VC 2003 aka 7.10 and VC 2002 aka 7.00 are treated identically and combined to 7.00 for perl purposes -fixed a bug that a console without gcc and without vc in the PATH autodetected to a gibberish MSVC version instead of erroring to the user --- win32/GNUmakefile | 56 +++++++++++++++++++++++++++++++++++++-------------- win32/makefile.mk | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 96 insertions(+), 20 deletions(-) diff --git a/win32/GNUmakefile b/win32/GNUmakefile index 9384120..6f1ef26 100644 --- a/win32/GNUmakefile +++ b/win32/GNUmakefile @@ -354,12 +354,32 @@ GCCTARGET := $(shell $(GCCBIN) -dumpmachine 2>NUL) ifneq ($(GCCTARGET),) CCTYPE := GCC else +WIN64 := $(shell for /f "tokens=3 delims=.^ " \ + %%i in ('cl ^2^>^&1') do @if "%%i" == "32-bit" echo undef) +#major version of CL has diff position based on 32 vs 64 +#Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64 +#Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86 #use var to capture 1st line only, not 8th token of lines 2 & 3 in cl.exe output -#rmving the cmd /c causes the var2b undef4echo but!4"set MSVCVER", cmd.exe bug? -MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=8 delims=.^ " \ - %%i in ('cl ^2^>^&1') do if not defined MSVCVER set /A "MSVCVER=%%i-6") \ - & cmd /c echo %%MSVCVER%%) -CCTYPE := MSVC$(MSVCVER)0 +#removing the cmd /c (extra scope) on the echo causes the env var to be undef +#when echo executes but it isn't undef for the "set MSVCVER", gmake or +#cmd.exe bug? +ifeq ($(WIN64),undef) +MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=8,9 delims=.^ " \ + %%i in ('cl ^2^>^&1') do if not defined MSVCVER if %%i%% geq 19 \ + (set /A "MSVCVER=((%%i-5)*10)+(%%j/10)") \ + else (set /A "MSVCVER=(%%i-6)*10")) & cmd /c echo %%MSVCVER%%) +else +MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=7,8 delims=.^ " \ + %%i in ('cl ^2^>^&1') do if not defined MSVCVER if %%i%% geq 19 \ + (set /A "MSVCVER=((%%i-5)*10)+(%%j/10)") \ + else (set /A "MSVCVER=(%%i-6)*10")) & cmd /c echo %%MSVCVER%%) +endif +#autodetect failed, reset to empty string +ifeq ($(MSVCVER),-50) +CCTYPE := +else +CCTYPE := MSVC$(MSVCVER) +endif endif endif @@ -1179,17 +1199,23 @@ CFG_VARS = \ all : info rebasePE Extensions_nonxs $(PERLSTATIC) PostExt info : - @echo # CCTYPE=$(CCTYPE) ifeq ($(CCTYPE),GCC) - @echo # GCCBIN=$(GCCBIN) - @echo # GCCVER=$(GCCVER1).$(GCCVER2).$(GCCVER3) - @echo # GCCTARGET=$(GCCTARGET) - @echo # GCCCROSS=$(GCCCROSS) -endif - @echo # WIN64=$(WIN64) - @echo # ARCHITECTURE=$(ARCHITECTURE) - @echo # ARCHNAME=$(ARCHNAME) - @echo # MAKE=$(PLMAKE) + @echo # CCTYPE=$(CCTYPE)&& \ + echo # GCCBIN=$(GCCBIN)&& \ + echo # GCCVER=$(GCCVER1).$(GCCVER2).$(GCCVER3)&& \ + echo # GCCTARGET=$(GCCTARGET)&& \ + echo # GCCCROSS=$(GCCCROSS)&& \ + echo # WIN64=$(WIN64)&& \ + echo # ARCHITECTURE=$(ARCHITECTURE)&& \ + echo # ARCHNAME=$(ARCHNAME)&& \ + echo # MAKE=$(PLMAKE) +else + @echo # CCTYPE=$(CCTYPE)&& \ + echo # WIN64=$(WIN64)&& \ + echo # ARCHITECTURE=$(ARCHITECTURE)&& \ + echo # ARCHNAME=$(ARCHNAME)&& \ + echo # MAKE=$(PLMAKE) +endif ifeq ($(CCTYPE),) @echo Unable to detect gcc and/or architecture! @exit 1 diff --git a/win32/makefile.mk b/win32/makefile.mk index 293abf9..9aad481 100644 --- a/win32/makefile.mk +++ b/win32/makefile.mk @@ -349,15 +349,34 @@ BUILDOPT += -DWIN32_NO_REGISTRY #no explicit CCTYPE given, do auto detection .IF "$(CCTYPE)" == "" -GCCTARGET *= $(shell gcc -dumpmachine 2>NUL & exit /b 0) +GCCTARGET := $(shell gcc -dumpmachine 2>NUL & exit /b 0) #do we have a GCC? .IF "$(GCCTARGET)" != "" CCTYPE = GCC .ELSE +WIN64 := $(shell for /f "tokens=3 delims=.^ " \ + %i in ('cl ^2^>^&1') do @if "%i" == "32-bit" echo undef) +#major version of CL has diff position based on 32 vs 64 +#Microsoft (R) C/C++ Optimizing Compiler Version 15.00.30729.01 for x64 +#Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86 #use var to capture 1st line only, not 8th token of lines 2 & 3 in cl.exe output -MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=8 delims=.^ " \ - %i in ('cl ^2^>^&1') do @if not defined MSVCVER set /A "MSVCVER=%i-6")) -CCTYPE := MSVC$(MSVCVER)0 +.IF "$(WIN64)" == "undef" +MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=8,9 delims=.^ " \ + %i in ('cl ^2^>^&1') do @if not defined MSVCVER if %i% geq 19 \ + (set /A "MSVCVER=((%i-5)*10)+(%j/10)") \ + else (set /A "MSVCVER=(%i-6)*10"))) +.ELSE +MSVCVER := $(shell (set MSVCVER=) & (for /f "tokens=7,8 delims=.^ " \ + %i in ('cl ^2^>^&1') do @if not defined MSVCVER if %i% geq 19 \ + (set /A "MSVCVER=((%i-5)*10)+(%j/10)") \ + else (set /A "MSVCVER=(%i-6)*10"))) +.ENDIF +#autodetect failed, reset to empty string +.IF "$(MSVCVER)" == "-50" +CCTYPE := +.ELSE +CCTYPE := MSVC$(MSVCVER) +.ENDIF .ENDIF .ENDIF @@ -524,7 +543,14 @@ BUILDOPT += -D__USE_MINGW_ANSI_STDIO MINIBUILDOPT += -D__USE_MINGW_ANSI_STDIO .ENDIF -GCCWRAPV *= $(shell 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)) +GCCVER1:= $(shell for /f "delims=. tokens=1,2,3" %i in ('gcc -dumpversion') do @echo %i) +GCCVER2:= $(shell for /f "delims=. tokens=1,2,3" %i in ('gcc -dumpversion') do @echo %j) +GCCVER3:= $(shell for /f "delims=. tokens=1,2,3" %i in ('gcc -dumpversion') do @echo %k) + +# If you are using GCC, 4.3 or later by default we add the -fwrapv option. +# See https://rt.perl.org/Ticket/Display.html?id=121505 +# +GCCWRAPV *= $(shell if "$(GCCVER1)"=="4" (if "$(GCCVER2)" geq "3" echo define) else if "$(GCCVER1)" geq "5" (echo define)) .IF "$(GCCWRAPV)" == "define" BUILDOPT += -fwrapv @@ -1141,6 +1167,30 @@ CFG_VARS = \ all : CHECKDMAKE rebasePE Extensions_nonxs $(PERLSTATIC) PostExt +info : +.IF "$(CCTYPE)" == "GCC" + @echo # CCTYPE=$(CCTYPE)&& \ + echo # CC=$(CC)&& \ + echo # GCCVER=$(GCCVER1).$(GCCVER2).$(GCCVER3)&& \ + echo # GCCTARGET=$(GCCTARGET)&& \ + echo # GCCCROSS=$(GCCCROSS)&& \ + echo # WIN64=$(WIN64)&& \ + echo # ARCHITECTURE=$(ARCHITECTURE)&& \ + echo # ARCHNAME=$(ARCHNAME)&& \ + echo # MAKE=$(PLMAKE) +.ELSE + @echo # CCTYPE=$(CCTYPE)&& \ + echo # WIN64=$(WIN64)&& \ + echo # ARCHITECTURE=$(ARCHITECTURE)&& \ + echo # ARCHNAME=$(ARCHNAME)&& \ + echo # MAKE=$(PLMAKE) +.ENDIF +.IF "$(CCTYPE)" == "" + @echo Unable to detect gcc and/or architecture! + @exit 1 +.ENDIF + + ..\regcomp$(o) : ..\regnodes.h ..\regcharclass.h ..\regexec$(o) : ..\regnodes.h ..\regcharclass.h -- 2.5.0.windows.1
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 181b
On Fri, 27 Jul 2018 13:48:12 -0700, bulk88 wrote: Newest patch expanded on that gmake "cmd /c" makefile comment. That was the only change I did. -- bulk88 ~ bulk88 at hotmail.com
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 574b
On Sat, 28 Jul 2018 12:19:29 -0700, bulk88 wrote: Show quoted text
> On Fri, 27 Jul 2018 13:48:12 -0700, bulk88 wrote: > > Newest patch expanded on that gmake "cmd /c" makefile comment. That > was the only change I did.
Thanks for the updated comment. I found the problem with GCCTARGET not getting set in the dmake case: It was because my environment already had CCTYPE set (to GCC). I copied a chunk from the gmake makefile to handle that and it all looks good now. Now committed to blead in commits b2029bebc5407a6527c355dec9c3e96aef8df9fc and 91584c7ae6cd348278f56d96e095d2d3c10f65f1.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org