Open aishwaryagm1999 opened 2 years ago
What is the entire exact error message?
PS C:\Users\Administrator\Desktop\wintun-maindtls> cargo build
Compiling winapi v0.3.9
Compiling wintun v0.2.1 (C:\Users\Administrator\Desktop\wintun-maindtls)
Compiling openssl-sys v0.9.73
error: could not find native static library C
, perhaps an -L flag is missing?
error: could not compile openssl-sys
due to previous error
warning: build failed, waiting for other jobs to finish...
error: build failed
This is the entire error I get when I try to build my program.
C
is the standard C library - if it's missing there seems to be something wrong with your C toolchain. I'm not super familiar with development in Windows unfortunately.
Any idea on how to fix the issue with C toolchain? could you help me out. I asked many people but none had a clear idea on how to solve it. Any suggestion or blog would be of great help for my project.
I probably don't know enough about Windows development to be a help there. In any case, I don't think this issue is specifically related to the openssl crate.
I get the following error when I try to run the below code for a DTLS client server program using rust through visual studio code and its terminal. I have already installed openssl libraries using vcpkg and set the environment variables. I have also installed the c/c++ extensions for vscode.
Error: error: could not find native static library C, perhaps an -L flag is missing? How do I resolve this error? My DTLS code is given below along with build.rs and cargo.toml
MAIN.rs use openssl::ssl::SslMethod; use std::{ io::{Read, Write}, net::UdpSocket, thread, time::Duration, }; use udp_dtls::{Certificate, DtlsAcceptor, DtlsConnector, Identity, SrtpProfile}; use udp_dtls::{DtlsAcceptorBuilder, UdpChannel}; fn main() { let buffer = include_bytes!("../test/identity.p12"); let identity = Identity::from_pkcs12(buffer, "mypass").unwrap(); let root_ca = include_bytes!("../test/root-ca.der"); let root_ca = Certificate::from_der(root_ca).unwrap(); let acceptor = DtlsAcceptor::builder(identity).build().unwrap(); let connector = DtlsConnector::builder() .add_srtp_profile(SrtpProfile::Aes128CmSha180) .add_srtp_profile(SrtpProfile::AeadAes256Gcm) .add_root_certificate(root_ca) .build() .unwrap(); let server = UdpSocket::bind("127.0.0.1:0").unwrap(); let client = UdpSocket::bind("127.0.0.1:0").unwrap(); let server_addr = server.local_addr().unwrap(); let client_addr = client.local_addr().unwrap(); let server_channel = UdpChannel { socket: server, remote_addr: client_addr, }; et client_channel = UdpChannel { socket: client, remote_addr: server_addr, }; let guard = thread::spawn(move || { let mut dtls_server = acceptor.accept(server_channel).unwrap(); let mut count = 0; while true { let mut received = [0; 5]; dtls_server.read_exact(&mut received); println!( "{:?} {:?}", count, String::from_utf8_lossy(received.as_ref()) ); count = count + 1; thread::sleep(Duration::from_millis(2)); } }); let mut dtls_client = connector.connect("foobar.com", client_channel).unwrap(); while true { let mut buf = [0; 5]; let buf = b"hello"; dtls_client.write_all(buf); thread::sleep(Duration::from_millis(30)); } }
CARGO.toml [package] name = "udp-dtls" version = "0.1.0" authors = ["Timon Post https://github.com/TimonPost"] edition = "2018" description = "DTLS abstraction ontop of UDP" repository = "https://github.com/TimonPost/udp-dtls" documentation = "https://docs.rs/udp-dtls/" license = "MIT" keywords = ["DTLS", "UDP", "connection", "openssl", "ssl"] exclude = ["target", "Cargo.lock"] readme = "README.md" [dependencies] openssl = "0.10.19" openssl-probe = "0.1.2" log = "0.4.6" bytes = "0.4.11" [features] vendored = ["openssl/vendored"]
BUILD.rs
use std::fs::File; use std::io::Write; use std::process::Command; use std::env; fn main() -> std::io::Result<()> {
}
For further reference please check this link for full code: https://github.com/TimonPost/udp-dtls