Looks like OpenSSL can't build with a Windows-native version of Perl? Oh goody.
According to the openssl docs, you might have better luck installing OpenSSL via vcpkg and letting it use that. That way, it's hopefully someone else's problem to get it to build. I can't assist with that since I don't use vcpkg.
If you still want to build OpenSSL, first make sure you're using the MinGW version of Perl, not the Windows-native build. That might mean running the cargo build from inside a MinGW shell, not Powershell. You can also try temporarily overriding PATH to force MinGW's perl to be used first (assuming that's how the build script finds perl).
If that doesn't work, you might need to install Cygwin, install Perl inside of Cygwin, then run the Windows build from inside a Cygwin shell. That version of Perl should definitely use UNIX paths, not Windows paths.
To be honest, stuff like this is exactly why I've always avoided any crate that uses openssl. Hell, any crate that relies on a UNIX environment on Windows in general. I've never managed to get the damn thing to reliably build, so I just stay away.
i install them by msys2's pacman and check it , output blow
uyplayer@UYPLAYER-PC MSYS ~
$ openssl version -a
OpenSSL 3.1.2 1 Aug 2023 (Library: OpenSSL 3.1.2 1 Aug 2023)
built on: Wed Aug 2 06:20:27 2023 UTC
platform: Cygwin-x86_64
options: bn(64,64)
compiler: gcc -march=nocona -msahf -mtune=generic -O2 -pipe -DTERMIOS -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_BUILDING_OPENSSL -DNDEBUG
OPENSSLDIR: "/usr/ssl"
ENGINESDIR: "/usr/lib/openssl/engines-3"
MODULESDIR: "/usr/lib/ossl-modules"
Seeding source: os-specific
CPUINFO: OPENSSL_ia32cap=0xfffaf38bffcbffff:0x184007a4239c27a9
uyplayer@UYPLAYER-PC MSYS ~
$ perl -v
This is perl 5, version 36, subversion 1 (v5.36.1) built for x86_64-msys-thread-multi
Copyright 1987-2023, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at https://www.perl.org/, the Perl Home Page.
Installing packages in msys doesn't mean other programs can find them. That's why I said you might need to run the cargo build from inside the MinGW/msys shell. PowerShell is not going to know anything about what's in msys. My assumption is that the openssl build script is expecting Perl to just be on PATH, and isn't doing anything more to locate it. [1]
The Microsoft build tools have a similar problem: you're supposed to use a different shell for each combination of (host platform, target platform). However, rustc is smarter than this, and will actually locate the installed build tools without having to be told where they are, or needing the environment configured. Everything should work like this... but sadly doesn't. âŠī¸