Perl error on windows platform , i installed openssl and perl by msys2

PS D:\Rust\protocols> cargo run
   Compiling openssl-sys v0.9.92
error: failed to run custom build command for `openssl-sys v0.9.92`

Caused by:
  process didn't exit successfully: `D:\Rust\protocols\target\debug\build\openssl-sys-7805ae33ec4a084a\build-script-main` (exit code: 101)
  --- stdout
  cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_GNU_OPENSSL_NO_VENDOR
  X86_64_PC_WINDOWS_GNU_OPENSSL_NO_VENDOR unset
  cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
  OPENSSL_NO_VENDOR unset
  cargo:rerun-if-env-changed=CC_x86_64-pc-windows-gnu
  CC_x86_64-pc-windows-gnu = None
  cargo:rerun-if-env-changed=CC_x86_64_pc_windows_gnu
  CC_x86_64_pc_windows_gnu = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-pc-windows-gnu
  CFLAGS_x86_64-pc-windows-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_pc_windows_gnu
  CFLAGS_x86_64_pc_windows_gnu = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=AR_x86_64-pc-windows-gnu
  AR_x86_64-pc-windows-gnu = None
  cargo:rerun-if-env-changed=AR_x86_64_pc_windows_gnu
  AR_x86_64_pc_windows_gnu = None
  cargo:rerun-if-env-changed=HOST_AR
  HOST_AR = None
  cargo:rerun-if-env-changed=AR
  AR = None
  cargo:rerun-if-env-changed=ARFLAGS_x86_64-pc-windows-gnu
  ARFLAGS_x86_64-pc-windows-gnu = None
  cargo:rerun-if-env-changed=ARFLAGS_x86_64_pc_windows_gnu
  ARFLAGS_x86_64_pc_windows_gnu = None
  cargo:rerun-if-env-changed=HOST_ARFLAGS
  HOST_ARFLAGS = None
  cargo:rerun-if-env-changed=ARFLAGS
  ARFLAGS = None
  cargo:rerun-if-env-changed=RANLIB_x86_64-pc-windows-gnu
  RANLIB_x86_64-pc-windows-gnu = None
  cargo:rerun-if-env-changed=RANLIB_x86_64_pc_windows_gnu
  RANLIB_x86_64_pc_windows_gnu = None
  cargo:rerun-if-env-changed=HOST_RANLIB
  HOST_RANLIB = None
  cargo:rerun-if-env-changed=RANLIB
  RANLIB = None
  cargo:rerun-if-env-changed=RANLIBFLAGS_x86_64-pc-windows-gnu
  RANLIBFLAGS_x86_64-pc-windows-gnu = None
  cargo:rerun-if-env-changed=RANLIBFLAGS_x86_64_pc_windows_gnu
  RANLIBFLAGS_x86_64_pc_windows_gnu = None
  cargo:rerun-if-env-changed=HOST_RANLIBFLAGS
  HOST_RANLIBFLAGS = None
  cargo:rerun-if-env-changed=RANLIBFLAGS
  RANLIBFLAGS = None
  running "perl" "./Configure" "--prefix=/D/Rust/protocols/target/debug/build/openssl-sys-61274dd2ae0d363c/out/openssl-build/install" "--openssldir=SYS$MANAGER:[OPENSSL]" "no-dso" "no-shared" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "no-engine" "mingw64" "-O2" "-ffunction-sections" "-fdata-sections" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-Wa,-mbig-obj"
  Configuring OpenSSL version 1.1.1v (0x1010116fL) for mingw64
  Using os-specific seed configuration

  --- stderr

  ******************************************************************************
  This perl implementation doesn't produce Unix like paths (with forward slash
  directory separators).  Please use an implementation that matches your
  building platform.

  This Perl version: 5.32.1 for MSWin32-x64-multi-thread
  ******************************************************************************
  thread 'main' panicked at '


  Error configuring OpenSSL build:
      Command: "perl" "./Configure" "--prefix=/D/Rust/protocols/target/debug/build/openssl-sys-61274dd2ae0d363c/out/openssl-build/install" "--openssldir=SYS$MANAGER:[OPENSSL]" "no-dso" "no-shared" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "no-engine" "mingw64" "-O2" "-ffunction-sections" "-fdata-sections" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-Wa,-mbig-obj"
      Exit status: exit code: 255


      ', C:\Users\uyplayer\.cargo\registry\src\index.crates.io-6f17d22bba15001f\openssl-src-111.27.0+1.1.1v\src\lib.rs:506:13
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
PS D:\Rust\protocols>

cargo run failed
i tried to install openssl and perl by exe file , also tried using installing them by msys2
. both of them give same error

I don't know the answer, but I posted a link to this question in The Perl Community group in Facebook. You might get some useful input there.

1 Like

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.

2 Likes

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.

but when i run cargo build , it shows error


PS D:\Rust\protocols> cargo build
   Compiling openssl-sys v0.9.92
   Compiling rustls-webpki v0.101.4
   Compiling sct v0.7.0
   Compiling rustls v0.21.7
error: failed to run custom build command for `openssl-sys v0.9.92`

Caused by:
  process didn't exit successfully: `D:\Rust\protocols\target\debug\build\openssl-sys-7805ae33ec4a084a\build-script-main` (exit code: 101)
  --- stdout
  cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_GNU_OPENSSL_NO_VENDOR
  X86_64_PC_WINDOWS_GNU_OPENSSL_NO_VENDOR unset
  cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
  OPENSSL_NO_VENDOR unset
  cargo:rerun-if-env-changed=CC_x86_64-pc-windows-gnu
  CC_x86_64-pc-windows-gnu = None
  cargo:rerun-if-env-changed=CC_x86_64_pc_windows_gnu
  CC_x86_64_pc_windows_gnu = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-pc-windows-gnu
  CFLAGS_x86_64-pc-windows-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_pc_windows_gnu
  CFLAGS_x86_64_pc_windows_gnu = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=AR_x86_64-pc-windows-gnu
  AR_x86_64-pc-windows-gnu = None
  cargo:rerun-if-env-changed=AR_x86_64_pc_windows_gnu
  AR_x86_64_pc_windows_gnu = None
  cargo:rerun-if-env-changed=HOST_AR
  HOST_AR = None
  cargo:rerun-if-env-changed=AR
  AR = None
  cargo:rerun-if-env-changed=ARFLAGS_x86_64-pc-windows-gnu
  ARFLAGS_x86_64-pc-windows-gnu = None
  cargo:rerun-if-env-changed=ARFLAGS_x86_64_pc_windows_gnu
  ARFLAGS_x86_64_pc_windows_gnu = None
  cargo:rerun-if-env-changed=HOST_ARFLAGS
  HOST_ARFLAGS = None
  cargo:rerun-if-env-changed=ARFLAGS
  ARFLAGS = None
  cargo:rerun-if-env-changed=RANLIB_x86_64-pc-windows-gnu
  RANLIB_x86_64-pc-windows-gnu = None
  cargo:rerun-if-env-changed=RANLIB_x86_64_pc_windows_gnu
  RANLIB_x86_64_pc_windows_gnu = None
  cargo:rerun-if-env-changed=HOST_RANLIB
  HOST_RANLIB = None
  cargo:rerun-if-env-changed=RANLIB
  RANLIB = None
  cargo:rerun-if-env-changed=RANLIBFLAGS_x86_64-pc-windows-gnu
  RANLIBFLAGS_x86_64-pc-windows-gnu = None
  cargo:rerun-if-env-changed=RANLIBFLAGS_x86_64_pc_windows_gnu
  RANLIBFLAGS_x86_64_pc_windows_gnu = None
  cargo:rerun-if-env-changed=HOST_RANLIBFLAGS
  HOST_RANLIBFLAGS = None
  cargo:rerun-if-env-changed=RANLIBFLAGS
  RANLIBFLAGS = None
  running "perl" "./Configure" "--prefix=/D/Rust/protocols/target/debug/build/openssl-sys-61274dd2ae0d363c/out/openssl-build/install" "--openssldir=SYS$MANAGER:[OPENSSL]" "no-dso" "no-shared" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "no-engine" "mingw64" "-O2" "-ffunction-sections" "-fdata-sections" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-Wa,-mbig-obj"

  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: NotFound, message: "program not found" }', C:\Users\uyplayer\.cargo\registry\src\index.crates.io-6f17d22bba15001f\openssl-src-111.27.0+1.1.1v\src\lib.rs:504:39
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...


here says not found

  running "perl" "./Configure" "--prefix=/D/Rust/protocols/target/debug/build/openssl-sys-61274dd2ae0d363c/out/openssl-build/install" "--openssldir=SYS$MANAGER:[OPENSSL]" "no-dso" "no-shared" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "no-engine" "mingw64" "-O2" "-ffunction-sections" "-fdata-sections" "-gdwarf-2" "-fno-omit-frame-pointer" "-m64" "-Wa,-mbig-obj"

  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: NotFound, message: "program not found" }', C:\Users\uyplayer\.cargo\registry\src\index.crates.io-6f17d22bba15001f\openssl-src-111.27.0+1.1.1v\src\lib.rs:504:39
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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]


  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. :frowning: â†Šī¸Ž

1 Like

thanks

To side step the problem, do you need openssl? It's a lot easier to build on window using rusttls?

i change the toolchain to msvc , and problom solevd . in gnu toolchain , unable to handle the error