WeDPR-Lab-Core icon indicating copy to clipboard operation
WeDPR-Lab-Core copied to clipboard

windows openssl compilation error

Open triplewz opened this issue 4 years ago • 6 comments

你好,请问这个能在windows下编译吗,我编译的时候出现这个问题是怎么回事呢?

error: failed to run custom build command for `openssl-sys v0.9.60`

Caused by:
  process didn't exit successfully: `D:\rust\WeDPR-Lab-Core\target\debug\build\openssl-sys-9907d4d9e796620a\build-script-main` (exit code: 101)
  --- stdout
  cargo:rustc-cfg=const_fn
  cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_NO_VENDOR
  X86_64_PC_WINDOWS_MSVC_OPENSSL_NO_VENDOR unset
  cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
  OPENSSL_NO_VENDOR unset
  running "perl" "./Configure" "--prefix=D:\\rust\\WeDPR-Lab-Core\\target\\debug\\build\\openssl-sys-d00d5dea42c1c716\\out\\openssl-build\\install" "no-dso" "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" "no-asm" "VC-WIN64A"

  --- stderr

triplewz avatar Jan 12 '21 12:01 triplewz

It can be compiled on Windows, but you need to install openssl library first.

The easiest way is to install Strawberry Perl, which will include all the requried openssl dependences.

https://strawberryperl.com/

qyan-dev avatar Jan 13 '21 08:01 qyan-dev

It can be compiled on Windows, but you need to install openssl library first.

The easiest way is to install Strawberry Perl, which will include all the requried openssl dependences.

https://strawberryperl.com/

Some of features need openssl source code for cross compilation targeting other instruction set.

But for x86/x64, there is actually an easier way to install precompiled openssl from https://slproweb.com/products/Win32OpenSSL.html

  1. Please use the default install path.
  2. After installation, set system environment variable OPENSSL_DIR=C:\Program Files\OpenSSL-Win64

Then cargo build should work.

qyan-dev avatar Jan 13 '21 10:01 qyan-dev

I have installed OPENSSL, and set system environment variable. 微信截图_20210114144229 But it did't work.

error: failed to run custom build command for `openssl-sys v0.9.60`

Caused by:
  process didn't exit successfully: `C:\Users\rust\WeDPR-Lab-Core\target\debug\build\openssl-sys-9907d4d9e796620a\build-script-main` (exit code: 101)
  --- stdout
  cargo:rustc-cfg=const_fn
  cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_NO_VENDOR
  X86_64_PC_WINDOWS_MSVC_OPENSSL_NO_VENDOR unset
  cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
  OPENSSL_NO_VENDOR unset
  running "perl" "./Configure" "--prefix=C:\\Users\\rust\\WeDPR-Lab-Core\\target\\debug\\build\\openssl-sys-d00d5dea42c1c716\\out\\openssl-build\\install" "no-dso" "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" "no-asm" "VC-WIN64A"

  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "系统找不到指定的文件。" }', C:\Users\.cargo\registry\src\mirrors.sjtug.sjtu.edu.cn-7a04d2510079875b\openssl-src-111.13.0+1.1.1i\src\lib.rs:413:39

triplewz avatar Jan 14 '21 06:01 triplewz

Strange. Use openssl on Windows is complex :-)

Could you try to remove OPENSSL_INCLUDE_DIR and OPENSSL_LIB_DIR?

I only set OPENSSL_DIR=C:\Program Files\OpenSSL-Win64 on my computer.

If it is still not working , just try installing the Strawberry Perl.

https://strawberryperl.com/

qyan-dev avatar Jan 18 '21 08:01 qyan-dev

I reinstalled OPENSSL, and built it successfully. Thanks!

triplewz avatar Jan 19 '21 01:01 triplewz

Cool. Good to know this :-)

qyan-dev avatar Jan 20 '21 09:01 qyan-dev