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: retire visual studio 2013 support #21624

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 8 additions & 23 deletions README.win32
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ additional software to run (other than what came with your operating
system). Currently, this port is capable of using one of the
following compilers on the Intel x86 and x86_64 architectures:

Microsoft Visual C++ version 12.0 or later
Microsoft Visual C++ Visual C++ 2015 (version 14.0) or later
Intel C++ Compiler (experimental)
Gcc by mingw.org gcc version 3.4.5-5.3.0
Gcc by mingw-w64.org gcc version 4.4.3 or later
Expand All @@ -65,14 +65,8 @@ that are also supported by perl's makefile.
=back

The Microsoft Visual C++ compilers are also now being given away free. They
are available as "Visual C++ 2013-2022 Community Edition" and are the same
compilers that ship with "Visual C++ 2013-2022 Professional".

Visual C++ 2013 is capable of B<targeting> XP and Windows Server 2003 but the
build host requirement is Windows 7/Windows Server 2012. For more details see
https://docs.microsoft.com/en-us/visualstudio/productinfo/vs2013-compatibility-vs
and
https://docs.microsoft.com/en-us/visualstudio/productinfo/vs2013-sysrequirements-vs
are available as "Visual C++ 2015-2022 Community Edition" and are the same
compilers that ship with "Visual C++ 2015-2022 Professional".

The MinGW64 compiler is available at L<https://mingw-w64.org>.
The latter is actually a cross-compiler targeting Win64. There's also a trimmed
Expand Down Expand Up @@ -129,23 +123,23 @@ console already set up for your target architecture (x86-32 or x86-64 or IA64).
With the newer compilers, you may also use the older batch files if you choose
so.

=item Microsoft Visual C++ 2013-2022 Community Edition
=item Microsoft Visual C++ 2015-2022 Community Edition

These free versions of Visual C++ 2013-2022 Professional contain the same
These free versions of Visual C++ 2015-2022 Professional contain the same
compilers and linkers that ship with the full versions, and also contain
everything necessary to build Perl.

These packages can be downloaded from L<https://visualstudio.microsoft.com/>.

Install Visual C++ 2013-2022 Community, then setup your environment
Install Visual C++ 2015-2022 Community, then setup your environment
using, e.g.

F<C:\Program Files\Microsoft Visual Studio 12.0\Common7\Tools\vsvars32.bat>
F<C:\Program Files\Microsoft Visual Studio 14.0\Common7\Tools\vsvars32.bat>

(assuming the default installation location was chosen).

Perl should now build using the F<win32/Makefile>. You will need to edit that
file to set C<CCTYPE> to one of C<MSVC120>-C<MSVC143> first.
file to set C<CCTYPE> to one of C<MSVC140>-C<MSVC143> first.

=item Microsoft C++ Build Tools

Expand Down Expand Up @@ -264,15 +258,6 @@ of the tests from the testsuite (many tests will be skipped).

There should be no test failures.

If you build with Visual C++ 2013 then three tests currently may fail with
Daylight Saving Time related problems: F<t/io/fs.t>,
F<cpan/HTTP-Tiny/t/110_mirror.t> and F<lib/File/Copy.t>. The failures are
caused by bugs in the CRT in VC++ 2013 which are fixed in VC++2015 and
later, as explained by Microsoft here:
L<https://connect.microsoft.com/VisualStudio/feedback/details/811534/utime-sometimes-fails-to-set-the-correct-file-times-in-visual-c-2013>. In the meantime,
if you need fixed C<stat> and C<utime> functions then have a look at the
CPAN distribution Win32::UTCFileTime.

If you build with Visual C++ 2015 or later then F<ext/XS-APItest/t/locale.t>
may crash (after all its tests have passed). This is due to a regression in the
Universal CRT introduced in the Windows 10 April 2018 Update, and will be fixed
Expand Down
33 changes: 4 additions & 29 deletions win32/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ DEFAULT_INC_EXCLUDES_DOT := define
#
# uncomment exactly one of the following
#
# Visual C++ 2013 (aka Visual C++ 12.0) (full version or Express Edition)
#CCTYPE := MSVC120
# Visual C++ 2015 (aka Visual C++ 14.0) (full version or Express Edition)
#CCTYPE := MSVC140
# Visual C++ 2017 (aka Visual C++ 14.1) (full version or Community Edition)
Expand Down Expand Up @@ -386,8 +384,6 @@ endif
ifeq ($(CCHOME),)
ifeq ($(CCTYPE),GCC)
CCHOME := C:\MinGW
else ifeq ($(CCTYPE),MSVC120)
CCHOME := $(VCINSTALLDIR)
else ifeq ($(CCTYPE),MSVC140)
CCHOME := $(VCINSTALLDIR)
else
Expand Down Expand Up @@ -503,13 +499,7 @@ CCLIBDIR := $(CCHOME)\lib;$(CCHOME)\$(GCCTARGET)\lib;$(CCHOME)\lib\gcc\$(GCCTARG
ARCHPREFIX :=
else
CCINCDIR := $(CCHOME)\include
ifeq ($(CCTYPE),MSVC120)
ifeq ($(WIN64),define)
CCLIBDIR := $(CCHOME)\lib\amd64
else
CCLIBDIR := $(CCHOME)\lib
endif
else ifeq ($(CCTYPE),MSVC140)
ifeq ($(CCTYPE),MSVC140)
ifeq ($(WIN64),define)
CCLIBDIR := $(CCHOME)\lib\amd64
else
Expand Down Expand Up @@ -685,11 +675,7 @@ CXX_FLAG += -std:c++20
endif
EXTRACFLAGS = -nologo -GF -W3

ifeq ($(CCTYPE),MSVC120)
LIBC = msvcrt.lib
else
LIBC = ucrt.lib
endif

ifeq ($(CFG),Debug)
OPTIMIZE = -Od -Zi
Expand All @@ -701,11 +687,7 @@ OPTIMIZE = -Od -Zi
LINK_DBG = -debug
EXTRACFLAGS += -MD
else ifeq ($(CFG),DebugFull)
ifeq ($(CCTYPE),MSVC120)
LIBC = msvcrtd.lib
else
LIBC = ucrtd.lib
endif
OPTIMIZE = -Od -Zi
LINK_DBG = -debug
DEFINES += -D_DEBUG -DDEBUGGING
Expand Down Expand Up @@ -734,25 +716,20 @@ endif

# For now, silence warnings about "unsafe" CRT functions
# and POSIX CRT function names being deprecated.
DEFINES += -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE

# Likewise for deprecated Winsock APIs in VC++ 14.0 onwards for now.
ifneq ($(CCTYPE),MSVC120)
DEFINES += -D_WINSOCK_DEPRECATED_NO_WARNINGS
endif
# Likewise for deprecated Winsock APIs
DEFINES += -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
-D_WINSOCK_DEPRECATED_NO_WARNINGS

LIBBASEFILES = 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

ifneq ($(CCTYPE),MSVC120)
ifeq ($(CFG),DebugFull)
LIBBASEFILES += msvcrtd.lib vcruntimed.lib
else
LIBBASEFILES += msvcrt.lib vcruntime.lib
endif
endif

# Avoid __intel_new_proc_init link error for libircmt.
# libmmd is /MD equivalent, other variants exist.
Expand Down Expand Up @@ -1302,7 +1279,6 @@ $(MINIDIR)\.exists : $(CFGH_TMPL)
echo #undef I_QUADMATH&& \
echo #undef USE_QUADMATH&& \
echo #undef USE_CPLUSPLUS)>> $(MINI_CONFIG_H)
ifneq ($(CCTYPE),MSVC120)
@(echo #undef FILE_ptr&& \
echo #undef FILE_cnt&& \
echo #undef FILE_base&& \
Expand All @@ -1312,7 +1288,6 @@ ifneq ($(CCTYPE),MSVC120)
echo #define FILE_base^(fp^) PERLIO_FILE_base^(fp^)&& \
echo #define FILE_bufsiz^(fp^) ^(PERLIO_FILE_cnt^(fp^) + PERLIO_FILE_ptr^(fp^) - PERLIO_FILE_base^(fp^)^)&& \
echo #define I_STDBOOL)>> $(MINI_CONFIG_H)
endif
ifeq ($(WIN64),define)
ifeq ($(CCTYPE),GCC)
@(echo #define LONG_DOUBLESIZE ^16)>> $(MINI_CONFIG_H)
Expand Down
31 changes: 7 additions & 24 deletions win32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ DEFAULT_INC_EXCLUDES_DOT = define
#
# uncomment exactly one of the following
#
# Visual C++ 2013 (aka Visual C++ 12.0) (full version or Express Edition)
#CCTYPE = MSVC120
# Visual C++ 2015 (aka Visual C++ 14.0) (full version or Express Edition)
#CCTYPE = MSVC140
# Visual C++ 2017 (aka Visual C++ 14.1) (full version or Community Edition)
Expand Down Expand Up @@ -193,7 +191,7 @@ DEFAULT_INC_EXCLUDES_DOT = define
# Versions of Visual C++ up to VC++ 14.0 define $(VCINSTALLDIR), but from
# VC++ 14.1 we need the subfolder given by $(VCToolsInstallDir).
#
!IF "$(CCTYPE)" == "MSVC120" || "$(CCTYPE)" == "MSVC140"
!IF "$(CCTYPE)" == "MSVC140"
CCHOME = $(VCINSTALLDIR)
!ELSE
CCHOME = $(VCTOOLSINSTALLDIR)
Expand Down Expand Up @@ -371,7 +369,7 @@ MINIDELAYLOAD = -DELAYLOAD:advapi32.dll
# Set the install location of the compiler headers/libraries.
# These are saved into $Config{incpath} and $Config{libpth}.
CCINCDIR = $(CCHOME)\include
!IF "$(CCTYPE)" == "MSVC120" || "$(CCTYPE)" == "MSVC140"
!IF "$(CCTYPE)" == "MSVC140"
! IF "$(WIN64)" == "define"
CCLIBDIR = $(CCHOME)\lib\amd64
! ELSE
Expand Down Expand Up @@ -438,11 +436,7 @@ CXX_FLAG = $(CXX_FLAG) -std:c++20
!ENDIF
EXTRACFLAGS = -nologo -GF -W3

!IF "$(CCTYPE)" == "MSVC120"
LIBC = msvcrt.lib
!ELSE
LIBC = ucrt.lib
!ENDIF

!IF "$(CFG)" == "Debug"
OPTIMIZE = -Od -Zi
Expand All @@ -454,11 +448,7 @@ OPTIMIZE = -Od -Zi
LINK_DBG = -debug
EXTRACFLAGS = $(EXTRACFLAGS) -MD
!ELSEIF "$(CFG)" == "DebugFull"
! IF "$(CCTYPE)" == "MSVC120"
LIBC = msvcrtd.lib
! ELSE
LIBC = ucrtd.lib
! ENDIF
OPTIMIZE = -Od -Zi
LINK_DBG = -debug
DEFINES = $(DEFINES) -D_DEBUG -DDEBUGGING
Expand Down Expand Up @@ -486,25 +476,20 @@ OPTIMIZE = $(OPTIMIZE) -fp:precise

# For now, silence warnings about "unsafe" CRT functions
# and POSIX CRT function names being deprecated.
DEFINES = $(DEFINES) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE

# Likewise for deprecated Winsock APIs in VC++ 14.0 onwards for now.
!IF "$(CCTYPE)" != "MSVC120"
DEFINES = $(DEFINES) -D_WINSOCK_DEPRECATED_NO_WARNINGS
!ENDIF
# Likewise for deprecated Winsock APIs
DEFINES = $(DEFINES) -D_CRT_SECURE_NO_DEPRECATE \
-D_CRT_NONSTDC_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS

LIBBASEFILES = \
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

!IF "$(CCTYPE)" != "MSVC120"
! IF "$(CFG)" == "DebugFull"
!IF "$(CFG)" == "DebugFull"
LIBBASEFILES = $(LIBBASEFILES) msvcrtd.lib vcruntimed.lib
! ELSE
!ELSE
LIBBASEFILES = $(LIBBASEFILES) msvcrt.lib vcruntime.lib
! ENDIF
!ENDIF

# Avoid __intel_new_proc_init link error for libircmt.
Expand Down Expand Up @@ -963,7 +948,6 @@ $(MINIDIR)\.exists : $(CFGH_TMPL)
echo #undef USE_64_BIT_INT&& \
echo #undef USE_LONG_DOUBLE&& \
echo #undef USE_CPLUSPLUS)>> $(MINI_CONFIG_H)
!IF "$(CCTYPE)" != "MSVC120"
@(echo #undef FILE_ptr&& \
echo #undef FILE_cnt&& \
echo #undef FILE_base&& \
Expand All @@ -973,7 +957,6 @@ $(MINIDIR)\.exists : $(CFGH_TMPL)
echo #define FILE_base^(fp^) PERLIO_FILE_base^(fp^)&& \
echo #define FILE_bufsiz^(fp^) ^(PERLIO_FILE_cnt^(fp^) + PERLIO_FILE_ptr^(fp^) - PERLIO_FILE_base^(fp^)^)&& \
echo #define I_STDBOOL)>> $(MINI_CONFIG_H)
!ENDIF
!IF "$(WIN64)"=="define"
@(echo #define PTRSIZE ^8&& \
echo #define SSize_t $(INT64)&& \
Expand Down