Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use this crate on windows #1525

Closed
Kofituo opened this issue Sep 21, 2021 · 0 comments
Closed

Unable to use this crate on windows #1525

Kofituo opened this issue Sep 21, 2021 · 0 comments

Comments

@Kofituo
Copy link

Kofituo commented Sep 21, 2021

This crate cannot compile with the following error

   Compiling openssl-sys v0.9.66
error: failed to run custom build command for `openssl-sys v0.9.66`
Caused by:
  process didn't exit successfully: `C:\Users\taimoor\IdeaProjects\playground\target\debug\build\openssl-sys-2cd88c7e510671a4\build-script-main` (exit code: 101)
  --- stdout
  cargo:rustc-cfg=const_fn
  cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_LIB_DIR
  X86_64_PC_WINDOWS_MSVC_OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
  OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_INCLUDE_DIR
  X86_64_PC_WINDOWS_MSVC_OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
  OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_DIR
  X86_64_PC_WINDOWS_MSVC_OPENSSL_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_DIR
  OPENSSL_DIR unset
  note: vcpkg did not find openssl: Could not find library in Vcpkg tree package openssl is not installed for vcpkg triplet x64-windows-static-md
  --- stderr
  thread 'main' panicked at '
  Could not find directory of OpenSSL installation, and this `-sys` crate cannot
  proceed without this knowledge. If OpenSSL is installed and this crate had
  trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
  compilation process.
  Make sure you also have the development packages of openssl installed.
  For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.
  If you're in a situation where you think the directory *should* be found
  automatically, please open a bug at https://github.com/sfackler/rust-openssl
  and include information about your system as well as this message.
  $HOST = x86_64-pc-windows-msvc
  $TARGET = x86_64-pc-windows-msvc
  openssl-sys = 0.9.66
  It looks like you're compiling for MSVC but we couldn't detect an OpenSSL
  installation. If there isn't one installed then you can try the rust-openssl
  README for more information about how to download precompiled binaries of
  OpenSSL:
  https://github.com/sfackler/rust-openssl#windows
  ', C:\Users\taimoor\.cargo\registry\src\github.com-1ecc6299db9ec823\openssl-sys-0.9.66\build\find_normal.rs:174:5
  stack backtrace:
     0: std::panicking::begin_panic_handler
               at /rustc/c3c0f80d6081092faff801542dd82f0e2420152b\/library\std\src\panicking.rs:517
     1: std::panicking::begin_panic_fmt
               at /rustc/c3c0f80d6081092faff801542dd82f0e2420152b\/library\std\src\panicking.rs:460
     2: build_script_main::find_normal::find_openssl_dir
               at .\build\find_normal.rs:174
     3: build_script_main::find_normal::get_openssl::closure$0
               at .\build\find_normal.rs:15
     4: enum$<core::option::Option<std::ffi::os_str::OsString>, 1, 18446744073709551615, Some>::unwrap_or_else<std::ffi::os_str::OsString,build_script_main::find_normal::get_openssl::closure$0>
               at /rustc/c3c0f80d6081092faff801542dd82f0e2420152b\library\core\src\option.rs:776
     5: build_script_main::find_normal::get_openssl
               at .\build\find_normal.rs:15
     6: build_script_main::find_openssl
               at .\build\main.rs:55
     7: build_script_main::main
               at .\build\main.rs:63
     8: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
               at /rustc/c3c0f80d6081092faff801542dd82f0e2420152b\library\core\src\ops\function.rs:227

So after explicitly setting the OPENSSL_DIR variable to C:\Program Files\OpenSSL-Win64, I get this error

   Compiling openssl-sys v0.9.66
error: failed to run custom build command for `openssl-sys v0.9.66`
Caused by:
  process didn't exit successfully: `C:\Users\taimoor\IdeaProjects\playground\target\debug\build\openssl-sys-2cd88c7e510671a4\build-script-main` (exit code: 101)
  --- stdout
  cargo:rustc-cfg=const_fn
  cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_LIB_DIR
  X86_64_PC_WINDOWS_MSVC_OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
  OPENSSL_LIB_DIR unset
  cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_INCLUDE_DIR
  X86_64_PC_WINDOWS_MSVC_OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
  OPENSSL_INCLUDE_DIR unset
  cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_DIR
  X86_64_PC_WINDOWS_MSVC_OPENSSL_DIR unset
  cargo:rerun-if-env-changed=OPENSSL_DIR
  OPENSSL_DIR =  C:\Program Files\OpenSSL-Win64
  --- stderr
  thread 'main' panicked at 'OpenSSL library directory does not exist:  C:\Program Files\OpenSSL-Win64\lib', C:\Users\taimoor\.cargo\registry\src\github.com-1ecc6299db9ec823\openssl-sys-0.9.66\build/main.rs:66:9
  stack backtrace:

But C:\Program Files\OpenSSL-Win64\lib folder exists (confirmed using Path::new("C:\\Program Files\\OpenSSL-Win64\\lib").exists(), similar to what is in the source code) so I'm confused as to why it is producing that error message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant