1

I get an error when building a project with openssl dependency

Platform: Windows 10 x64, rustc version: 1.68.0

I tried installing openssl using vcpkg. The installation packages also didn't work for me. (v3.0.8 and v1.1.1t)

Cargo.toml:

reqwest = "0.11.14"

Error:

PS C:\Users\user\Desktop\WebCheckRs> cargo run
   Compiling openssl-sys v0.6.7
   Compiling mio v0.6.23
   Compiling url v0.2.38
   Compiling futures v0.3.26
error: failed to run custom build command for `openssl-sys v0.6.7`

Caused by:
  process didn't exit successfully: `C:\Users\user\Desktop\WebCheckRs\target\debug\build\openssl-sys-696ce7e201a8fc02\build-script-build` (exit code: 101)
  --- stdout
  cargo:rustc-link-search=native=C:\Program Files\vcpkg\installed\x64-windows\lib
  cargo:rustc-link-lib=dylib=ssl32
  cargo:rustc-link-lib=dylib=eay32
  cargo:include=C:\Program Files\vcpkg\installed\x64-windows\include
  TARGET = Some("x86_64-pc-windows-msvc")
  OPT_LEVEL = Some("0")
  TARGET = Some("x86_64-pc-windows-msvc")
  HOST = Some("x86_64-pc-windows-msvc")
  TARGET = Some("x86_64-pc-windows-msvc")
  TARGET = Some("x86_64-pc-windows-msvc")
  HOST = Some("x86_64-pc-windows-msvc")
  CC_x86_64-pc-windows-msvc = None
  CC_x86_64_pc_windows_msvc = None
  HOST_CC = None
  CC = None
  TARGET = Some("x86_64-pc-windows-msvc")
  HOST = Some("x86_64-pc-windows-msvc")
  CFLAGS_x86_64-pc-windows-msvc = None
  CFLAGS_x86_64_pc_windows_msvc = None
  HOST_CFLAGS = None
  CFLAGS = None
  DEBUG = Some("true")
  running: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.35.32215\\bin\\HostX64\\x64\\cl.exe" "/nologo" "/MD" "/Z7" "/I" "C:\\Program Files\\vcpkg\\installed\\x64-windows\\include" "/W4" "/FoC:\\Users\\user\\Desktop\\WebCheckRs\\target\\debug\\build\\openssl-sys-ea090d7f600d0dee\\out\\src/openssl_shim.o" "/c" "src/openssl_shim.c"
  openssl_shim.c
  src/openssl_shim.c(68): warning C4996: 'HMAC_Init_ex': Since OpenSSL 3.0
  src/openssl_shim.c(72): warning C4996: 'HMAC_Update': Since OpenSSL 3.0
  src/openssl_shim.c(76): warning C4996: 'HMAC_Final': Since OpenSSL 3.0
  src/openssl_shim.c(91): warning C4244: 'return': conversion from 'uint64_t' to 'long', possible loss of data
  src/openssl_shim.c(95): warning C4244: 'return': conversion from 'uint64_t' to 'long', possible loss of data
  src/openssl_shim.c(99): warning C4244: 'return': conversion from 'uint64_t' to 'long', possible loss of data
  src/openssl_shim.c(115): warning C4100: 'ctx': unreferenced formal parameter
  src/openssl_shim.c(126): error C2037: left of 'p' specifies undefined struct/union 'dh_st'
  src/openssl_shim.c(127): error C2037: left of 'g' specifies undefined struct/union 'dh_st'
  src/openssl_shim.c(128): error C2037: left of 'q' specifies undefined struct/union 'dh_st'
  src/openssl_shim.c(123): warning C4996: 'DH_new': Since OpenSSL 3.0
  src/openssl_shim.c(137): error C2037: left of 'cert_info' specifies undefined struct/union 'x509_st'
  src/openssl_shim.c(137): error C2037: left of 'cert_info' specifies undefined struct/union 'x509_st'
  src/openssl_shim.c(137): warning C4033: 'X509_get_extensions_shim' must return a value
  exit code: 2

  --- stderr
  thread 'main' panicked at '

  Internal error occurred: Command "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.35.32215\\bin\\HostX64\\x64\\cl.exe" "/nologo" "/MD" "/Z7" "/I" "C:\\Program Files\\vcpkg\\installed\\x64-windows\\include" "/W4" "/FoC:\\Users\\user\\Desktop\\WebCheckRs\\target\\debug\\build\\openssl-sys-ea090d7f600d0dee\\out\\src/openssl_shim.o" "/c" "src/openssl_shim.c" with args "cl.exe" did not execute successfully (status code exit code:2).

  ', C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\gcc-0.3.55\src\lib.rs:1672:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
Alexey Mirano
  • 43
  • 1
  • 4

0 Answers0