Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lysender/159820c2a9acd07a449ca2da598e5a81 to your computer and use it in GitHub Desktop.
Save lysender/159820c2a9acd07a449ca2da598e5a81 to your computer and use it in GitHub Desktop.
Rust - Windows - Install/configure OpenSSL using vcpkg

Scenario

I'm installing pub-sub-client crate but it requires openssl-sys dependency and it failed to install it due to OpenSSL error.

Guide

I'm using the vcpkg guide for Windows but with a small tweak.

https://github.com/microsoft/vcpkg#quick-start-windows

Steps

Make sure you have the pre-requisites. You only need the Visual Studo component that allows building C++ codes.

Prepare vcpkg:

> D:
> cd D:\Dev
> git clone https://github.com/microsoft/vcpkg
> cd vcpkg
> .\bootstrap-vcpkg.bat

Install openssl:

> .\vcpkg.exe install --triplet=x64-windows-static-md openssl

Integrate it to Visual Studio (may require elevated privilege):

> .\vcpkg.exe integrate install

Now, go back to your cargo project and try to build or run it:

> cargo run

Note: I have initially run the following but cargo didn't detect openssl.

> .\vcpkg.exe install openssl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment