Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for How to solve the Rust+TLS+Windows Nightmare
Michael
Michael

Posted on

     

How to solve the Rust+TLS+Windows Nightmare

Problem

Developing withrusttls oropenssl can be a huge pain when working with packages such asactix orawc. These packages tend to throw SSL errors when making requests or using a proxy to pass to any https url.

Solution

Install Visual Studio

  • Install the Compoment for Windows Development and Linux Embedded Development for C++ tools.

Install Rust

Set the toolchain tostable-x86_64-pc-windows-msvc

rustuptoolchaininstallstable-x86_64-pc-windows-msvcrustupdefaultstable-x86_64-pc-windows-msvc
Enter fullscreen modeExit fullscreen mode

Install Msys2

In msys2 install:

  pacman-Syu openssl-devel pkg-config mingw-w64-x86_64-toolchain
Enter fullscreen modeExit fullscreen mode

Setting up vcpkg

  1. Make a new folder:mkdir -p C:\tools
  2. Clone vcpkg:git clone https://github.com/microsoft/vcpkg
  3. Navigate toC:\tools\vcpkg
  4. Run the following install commands:
./bootstrap-vcpkg.bat./vcpkg.exeinstallopenssl-windows:x64-windows./vcpkg.exeinstallopenssl:x64-windows-static./vcpkg.exeintegrateinstall
Enter fullscreen modeExit fullscreen mode

Setting up Openssl Root Cert

  1. Create the directory:mkdir -p C:\Program Files\OpenSSL-Win64\certs
  2. Download the cacert.pem
  3. Place it in the certs directory.

Finally update all our environments:

  1. Add to path:
    • C:\msys64\mingw64\bin
  2. Add the following environment variables:
    • VCPKG_ROOT=C:\tools\vcpkg
    • SSL_CERT_FILE=C:\Program Files\OpenSSL-Win64\certs\cacert.pem
    • RUSTFLAGS=-Ctarget-feature=+crt-static
    • OPENSSL_NO_VENDOR=1

Conclusion

Developing with Rust and Windows can be a relatively painless process but justrusttls oropenssl can be a huge pain when working with packages such asactix orawc. There might be an easier way to accomplish this but these are the steps that I have found to be the most reliable and repeatable across multiple systems.

Sources

Thank you to these lovely peeps for getting me down the right path.

Top comments(1)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
bmbenson profile image
Bryan Benson
  • Joined

Thank you! Massive help!

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

404 awesome bio :P
  • Location
    Beaverton, Oregon
  • Education
    University of Phoenix
  • Pronouns
    He/Him
  • Work
    Advanced Software Developer at Private
  • Joined

More fromMichael

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp