STEEL
STEEL

Reputation: 10107

Error: could not find native static library `ssl`, perhaps an -L flag is missing? on WIndows

I'm trying to build this project on windows. -> https://github.com/alexanderbanks/rust-api

https://users.rust-lang.org/t/error-could-not-find-native-static-library-ssl-perhaps-an-l-flag-is-missing-on-windows/46777 When I run cargo build I get following error. Please note I have updated the dependencies to

[dependencies]
iron = "0.6.1"
router = "0.6.0"
time = "0.2.16"
serde = "1.0.114"
serde_derive = "1.0.114"
serde_json = "1.0.57"
diesel = { version = "1.4.5", features = ["postgres"] }
diesel_codegen = { version = "0.16.1", features = ["postgres"] }
dotenv = "0.15.0"
bcrypt = "0.8.1"
rand = "0.7.3"
bodyparser = "0.8.0"
frank_jwt = "3.1.2"

Windows PATH enter image description here

ERROR:

error: could not find native static library `ssl`, perhaps an -L flag is missing?

error: aborting due to previous error

error: could not compile `openssl-sys`.

Upvotes: 0

Views: 2665

Answers (1)

Lionel Foxcroft
Lionel Foxcroft

Reputation: 1737

I managed to get it to run by following the steps I found here.

Create a directory somewhere (they used C:\Tools), then cd into it and run the following:

git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
.\vcpkg.exe install openssl:x64-windows-static

This took about 15 minutes to run on my computer.

Once it's done, you need to set the following environment variables:

SET OPENSSL_DIR=C:\Tools\vcpkg\installed\x64-windows-static
SET OPENSSL_STATIC=Yes

Once all that's done, cd back into your project directory and run cargo build; it should work now.

Upvotes: 2

Related Questions