Repository: spack/spack

Issue:
Installation issue: Windows: perl with vs 2022
### Steps to reproduce the issue

```console
$ spack install perl
...
```

While using VS 2022 msvc

### Error message

<details><summary>Error message</summary><pre>
[+] C:\Users\trws\AppData\Local\Microsoft\WindowsApps (external python-3.9.10-6tr4wecjbs35znjqw5awxvs24xy2qxoy)
==> Installing perl-5.34.0-e3fhwahgshhg6y5opcq5pwangewoeri3
==> No binary for perl-5.34.0-e3fhwahgshhg6y5opcq5pwangewoeri3 found: installing from source
==> Using cached archive: C:\Users\trws\Repos\spack\var\spack\cache\_source-cache\archive\55\551efc818b968b05216024fb0b727ef2ad4c100f8cb6b43fab615fa78ae5be9a.tar.gz
==> Using cached archive: C:\Users\trws\Repos\spack\var\spack\cache\_source-cache\archive\9d\9da50e155df72bce55cb69f51f1dbb4b62d23740fb99f6178bb27f22ebdf8a46.tar.gz
==> Moving resource stage
        source: C:\Users\trws\Repos\spack\.staging\resource-cpanm-e3fhwahgshhg6y5opcq5pwangewoeri3\spack-src\
        destination: C:\Users\trws\Repos\spack\.staging\spack-stage-perl-5.34.0-e3fhwahgshhg6y5opcq5pwangewoeri3\spack-src\cpanm\cpanm
==> Ran patch() for perl
==> Error: ProcessError: Command exited with status 2:
    'nmake' 'install' 'CCTYPE=MSVC143' 'INST_TOP=C:\Users\trws\Repos\spack\opt\spack\windows-windows10-AMD64\msvc-19.31.31104\perl-5.34.0-e3fhwahgshhg6y5opcq5pwangewoeri3' 'INST_ARCH=\$(ARCHNAME)'

46 errors found in build log:
     89     ..\dump.c(1799): warning C4267: 'function': conversion from 'size_t
            ' to 'U32', possible loss of data
     90     ..\dump.c(1807): warning C4267: 'function': conversion from 'size_t
            ' to 'U32', possible loss of data
     91     ..\dump.c(2009): warning C4267: '=': conversion from 'size_t' to 'U
            32', possible loss of data
     92         cl -c -I.. -nologo -GF -W3 -MD -I..\lib\CORE -I.\include -I. -I..
            -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -D_CRT_SECURE_NO_DEPRECATE -
            D_CRT_NONSTDC_NO_DEPRECATE -DPERLDLL -DPERL_CORE   -O1 -Zi -GL -fp:
            precise  -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMP
            LICIT_SYS -Fo..\generate_uudmap.obj ..\generate_uudmap.c
     93     generate_uudmap.c
     94         link -out:..\generate_uudmap.exe @C:\Users\trws\AppData\Local\Temp
            \nm65A8.tmp
  >> 95     generate_uudmap.obj : error LNK2001: unresolved external symbol __i
            mp_exit
  >> 96     generate_uudmap.obj : error LNK2001: unresolved external symbol __i
            mp_fputc
  >> 97     generate_uudmap.obj : error LNK2001: unresolved external symbol __i
            mp_fopen
  >> 98     generate_uudmap.obj : error LNK2001: unresolved external symbol __i
            mp___acrt_iob_func
  >> 99     generate_uudmap.obj : error LNK2001: unresolved external symbol __i
            mp_fclose
  >> 100    generate_uudmap.obj : error LNK2001: unresolved external symbol __i
            mp___stdio_common_vfprintf
  >> 101    generate_uudmap.obj : error LNK2001: unresolved external symbol __i
            mp__errno
  >> 102    generate_uudmap.obj : error LNK2001: unresolved external symbol __i
            mp_fputs
  >> 103    generate_uudmap.obj : error LNK2001: unresolved external symbol __i
            mp_strerror
  >> 104    msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbo
            l _seh_filter_exe
  >> 105    msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbo
            l _set_app_type
  >> 106    msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbo
            l __setusermatherr
  >> 107    msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbo
            l _configure_narrow_argv
  >> 108    msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol
             _configure_narrow_argv
  >> 109    msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbo
            l _initialize_narrow_environment
  >> 110    msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol
             _initialize_narrow_environment
  >> 111    msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbo
            l _get_initial_narrow_environment
  >> 112    msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbo
            l _initterm
  >> 113    msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbo
            l _initterm_e
  >> 114    msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbo
            l exit
  >> 115    msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbo
            l _exit
  >> 116    msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbo
            l _set_fmode
  >> 117    msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbo
            l __p___argc
  >> 118    msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbo
            l __p___argv
  >> 119    msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbo
            l _cexit
  >> 120    msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol
             _cexit
  >> 121    msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbo
            l _c_exit
  >> 122    msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbo
            l _register_thread_local_exe_atexit_callback
  >> 123    msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbo
            l _configthreadlocale
  >> 124    msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbo
            l _set_new_mode
  >> 125    msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbo
            l __p__commode
  >> 126    msvcrt.lib(exe_main.obj) : error LNK2001: unresolved external symbo
            l __C_specific_handler
  >> 127    msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol
             __C_specific_handler
  >> 128    msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol
             _seh_filter_dll
  >> 129    msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol
             _initialize_onexit_table
  >> 130    msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol
             _register_onexit_function
  >> 131    msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol
             _execute_onexit_table
  >> 132    msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol
             _crt_atexit
  >> 133    msvcrt.lib(utility.obj) : error LNK2001: unresolved external symbol
             _crt_at_quick_exit
  >> 134    msvcrt.lib(tncleanup.obj) : error LNK2001: unresolved external symb
            ol __std_type_info_destroy_list
  >> 135    msvcrt.lib(utility_desktop.obj) : error LNK2001: unresolved externa
            l symbol terminate
  >> 136    msvcrt.lib(utility_desktop.obj) : error LNK2001: unresolved externa
            l symbol __current_exception
  >> 137    msvcrt.lib(utility_desktop.obj) : error LNK2001: unresolved externa
            l symbol __current_exception_context
  >> 138    msvcrt.lib(utility_desktop.obj) : error LNK2001: unresolved externa
            l symbol memset
  >> 139    ..\generate_uudmap.exe : fatal error LNK1120: 40 unresolved externa
            ls
  >> 140    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visua
            l Studio\2022\BuildTools\VC\Tools\MSVC\14.31.31103\bin\HostX64\x64\
            link.EXE"' : return code '0x460'
     141    Stop.
     142    Exception in thread Thread-3:
     143    Traceback (most recent call last):
     144      File "C:\Python39\lib\threading.py", line 954, in _bootstrap_inne
            r
     145        self.run()
     146      File "C:\Python39\lib\threading.py", line 892, in run

See build log for details:
  C:\Users\trws\Repos\spack\.staging\spack-stage-perl-5.34.0-e3fhwahgshhg6y5opcq5pwangewoeri3\spack-build-out.txt
</pre></details>


### Information on your system

* **Spack:** 0.17.1-1606-5a72204d38
* **Python:** 3.9.5
* **Platform:** windows-windows10-AMD64
* **Concretizer:** original

### Additional information

no longer available

### General information

- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [X] I have run `spack maintainers <name-of-the-package>` and **@mentioned** any maintainers
- [X] I have uploaded the build log and environment files
- [X] I have searched the issues of this repo and believe this is not a duplicate


Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/perl/package.py b/var/spack/repos/builtin/packages/perl/package.py
--- a/var/spack/repos/builtin/packages/perl/package.py
+++ b/var/spack/repos/builtin/packages/perl/package.py
@@ -47,6 +47,7 @@ class Perl(Package):  # Perl doesn't use Autotools, it should subclass Package
     version('5.31.4', sha256='418a7e6fe6485cc713a86d1227ef112f0bb3f80322e3b715ffe42851d97804a5')
 
     # Maintenance releases (even numbers, recommended)
+    version('5.34.1', sha256='357951a491b0ba1ce3611263922feec78ccd581dddc24a446b033e25acf242a1', preferred=True)
     version('5.34.0', sha256='551efc818b968b05216024fb0b727ef2ad4c100f8cb6b43fab615fa78ae5be9a', preferred=True)
     version('5.32.1', sha256='03b693901cd8ae807231b1787798cf1f2e0b8a56218d07b7da44f784a7caeb2c', preferred=True)
     version('5.32.0', sha256='efeb1ce1f10824190ad1cadbcccf6fdb8a5d37007d0100d2d9ae5f2b5900c0b4', preferred=True)
@@ -81,6 +82,7 @@ class Perl(Package):  # Perl doesn't use Autotools, it should subclass Package
         # :5.24.1 needs zlib@:1.2.8: https://rt.cpan.org/Public/Bug/Display.html?id=120134
         depends_on('zlib@:1.2.8', when='@5.20.3:5.24.1')
 
+    conflicts('@5.34.1:', when='%msvc@:19.29.30136')
     # there has been a long fixed issue with 5.22.0 with regard to the ccflags
     # definition.  It is well documented here:
     # https://rt.perl.org/Public/Bug/Display.html?id=126468


Test patch: