Cargo.toml
[package]
name = "tls_client_01"
version = "0.1.0"
edition = "2024"
[dependencies]
rustls = "0.23.26"
... \tls_client_01\src\main.rs
use std::error::Error;
use std::io::{Read, Write};
use std::net::TcpStream;
use std::sync::Arc;
use rustls::client::{ClientConnectionData, EarlyDataError, UnbufferedClientConnection};
use rustls::unbuffered::{
AppDataRecord, ConnectionState, EncodeError, EncryptError, InsufficientSizeError,
UnbufferedStatus, WriteTraffic,
};
use rustls::version::TLS13;
use rustls::{ClientConfig, RootCertStore};
fn main() -> Result<(), Box<dyn Error>> {
let root_store = RootCertStore {
roots: webpki_roots::TLS_SERVER_ROOTS.into(),
};
let mut config = ClientConfig::builder_with_protocol_versions(&[&TLS13])
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// full example, link:
// https://github.com/rustls/rustls/blob/main/examples/src/bin/unbuffered-client.rs
os win10_x64, cpu amd ryzen 5, rustc 1.86.0 (05f9846f8 2025-03-31)
on recommendation
download windows CMake
& NASM
installer
from cmd.exe
C:\Windows\system32>llvm-cov --version
LLVM (http://llvm.org/):
LLVM version 15.0.6
Optimized build.
Default target: x86_64-pc-windows-msvc
Host CPU: znver1
C:\Windows\system32>clang --version
clang version 15.0.6
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
from vs code
... \tls_client_01>$env:PATH
C:\Program Files\CMake\bin;
C:\Program Files\NASM;
C:\Program Files\LLVM\bin;;
... \tls_client_01>cmake --version
cmake version 4.0.1
CMake suite maintained and supported by Kitware.
... \tls_client_01>nasm --version
NASM version 2.16.03 compiled on Apr 17 2024
cargo run
... \tls_client_01> cargo run
Compiling aws-lc-sys v0.28.2
warning: aws-lc-sys@0.28.2: Building with: CMake
warning: aws-lc-sys@0.28.2: Symbol Prefix: Some("aws_lc_0_28_2")
warning: aws-lc-sys@0.28.2: Environment Variable found 'CMAKE': 'cmake'
warning: aws-lc-sys@0.28.2: CMAKE environment variable set: cmake
warning: aws-lc-sys@0.28.2: Compilation of 'c11.c' failed - Err(Error { kind: ToolExecError, message: "command did not execute successf
ully (status code exit code: 2): "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.35.
32215\\bin\\HostX64\\x64\\cl.exe" "-nologo" "-MD" "-Z7" "-Brepro" "-WX" "-W4" "-FoC:\\my_all_folders\\tls_client_01\\target\\debug\\
build\\aws-lc-sys-3a085190e471557f\\out\\out-c11\\e1bacabfea35bee3-c11.o" "-c" "C:\\Users\\mgm\\.cargo\\registry\
\src\\index.crates.io-1949cf8c6b5b557f\\aws-lc-sys-0.28.2\\aws-lc\\tests\\compiler_features_tests\\c11.c"" }).
error: failed to run custom build command for aws-lc-sys v0.28.2
Caused by:
process didn't exit successfully: C:\my_all_folders\tls_client_01\target\debug\build\aws-lc-sys-850851bb3dd990bf\build-script-main
(exit code: 101)
--- stdout
cargo:rerun-if-env-changed=AWS_LC_SYS_NO_PREFIX_x86_64_pc_windows_msvc
cargo:rerun-if-env-changed=AWS_LC_SYS_NO_PREFIX
...
...
cargo:rerun-if-env-changed=CMAKE_TOOLCHAIN_FILE
OPT_LEVEL = Some(0)
OUT_DIR = Some(C:\my_all_folders\tls_client_01\t
arget\debug\build\aws-lc-sys-3a085190e471557f\out)
TARGET = Some(x86_64-pc-windows-msvc)
cargo:rerun-if-env-changed=VCINSTALLDIR
VCINSTALLDIR = None
cargo:rerun-if-env-changed=VSTEL_MSBuildProjectFullPath
VSTEL_MSBuildProjectFullPath = None
cargo:rerun-if-env-changed=VSCMD_ARG_VCVARS_SPECTRE
VSCMD_ARG_VCVARS_SPECTRE = None
cargo:rerun-if-env-changed=WindowsSdkDir
WindowsSdkDir = None
cargo:rerun-if-env-changed=WindowsSDKVersion
WindowsSDKVersion = None
cargo:rerun-if-env-changed=LIB
LIB = None
PATH = Some(... ...;
C:\Program Files\CMake\bin;
C:\Program Files\NASM;... ...)
...
...
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\include\vcruntime_c11_stdatomic.h(122): error C2059
: syntax error: '}'
...
...
HOST_CMAKE = None
CMAKE = Some("cmake")
running: "cmake" "C:\Users\mgm\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\aws-lc-sys-0.28.2" "-G" "Visual Studio 17
2022" "-Thost=x64" "-Ax64" "-DBUILD_SHARED_LIBS=0" "-DBORINGSSL_PREFIX=aws_lc_0_28_2_" "-DBORINGSSL_PREFIX_HEADERS=C:\Users\mgm\.c
argo\registry\src\index.crates.io-1949cf8c6b5b557f\aws-lc-sys-0.28.2\generated-include" "-DBUILD_TESTING=OFF" "-DBUILD_TOOL=OFF" "
-DBUILD_LIBSSL=OFF" "-DDISABLE_PERL=ON" "-DDISABLE_GO=ON" "-DCMAKE_C_STANDARD=99" "-DCMAKE_INSTALL_PREFIX=C:\my_all_folders\tls_client_01\target\debug\build\aws-lc-sys-3a08
5190e471557f\out" "-DCMAKE_C_FLAGS= -nologo -MD -Brepro" "-DCMAKE_C_FLAGS_DEBUG= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS= -nologo -MD
-Brepro" "-DCMAKE_CXX_FLAGS_DEBUG= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS_DEBUG= -nologo -MD
-Brepro" "-DCMAKE_BUILD_TYPE=Debug" "--no-warn-unused-cli"
Not searching for unused variables given on the command line.
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.17763.
-- The C compiler identification is unknown
-- Configuring incomplete, errors occurred!
--- stderr
CMake Deprecation Warning at CMakeLists.txt:10 (cmake_policy):
The OLD behavior for policy CMP0091 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Error at CMakeLists.txt:14 (enable_language):
No CMAKE_C_COMPILER could be found.
thread 'main' panicked at C:\Users\mgm\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\cmake-0.1.54\src\lib.rs:1119:5:
command did not execute successfully, got: exit code: 1
build script failed, must exit now
note: run with RUST_BACKTRACE=1
environment variable to display a backtrace
My list of environment Path variables
not contain "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.35.32215\bin"
.
Other comments are also not clear how to solve. Help, pls.