Skip to content

Commit 05e6d7c

Browse files
committed
fix(sys): fix linking issue with mbedtls
1 parent fcd8c0e commit 05e6d7c

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

libcoap-sys/build.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
* See the README as well as the LICENSE file for more information.
66
*/
77

8-
use std::io::ErrorKind;
98
use std::{
109
default::Default,
1110
env,
11+
io::ErrorKind,
1212
path::{Path, PathBuf},
1313
process::Command,
1414
};
@@ -178,16 +178,13 @@ fn main() {
178178
// libcoap doesn't support overriding the MbedTLS CFLAGS, but doesn't set those
179179
// either, so we just set CFLAGS and hope they propagate.
180180
if let Some(mbedtls_include) = env::var_os("DEP_MBEDTLS_INCLUDE") {
181+
let mbedtls_library_path = Path::new(env::var_os("DEP_MBEDTLS_CONFIG_H").unwrap().as_os_str())
182+
.parent()
183+
.unwrap()
184+
.join("build")
185+
.join("library");
181186
build_config.env("CFLAGS", format!("-I{}", mbedtls_include.to_str().unwrap()));
182-
build_config.env(
183-
"PKG_CONFIG_PATH",
184-
Path::new(mbedtls_include.as_os_str())
185-
.parent()
186-
.unwrap()
187-
.join("lib")
188-
.join("pkgconfig")
189-
.into_os_string(),
190-
);
187+
build_config.env("LDFLAGS", format!("-L{}", mbedtls_library_path.to_str().unwrap()));
191188
}
192189
},
193190
DtlsBackend::GnuTls => {

0 commit comments

Comments
 (0)