Skip to content

Commit e7604e0

Browse files
haraldhlzha101
authored andcommitted
fix(sgx-dcap-quoteverify-sys): successfull build with SGX_SDK unset
If `SGX_SDK` is unset, a single `-I` argument is passed to the C compiler, which leads to an unsuccesful build, even if the needed header files are present in the standard include path. Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
1 parent b1cdd25 commit e7604e0

File tree

1 file changed

+10
-7
lines changed
  • QuoteVerification/dcap_quoteverify/sgx-dcap-quoteverify-sys

1 file changed

+10
-7
lines changed

QuoteVerification/dcap_quoteverify/sgx-dcap-quoteverify-sys/build.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,25 @@ fn main() {
4242
// Tell cargo to invalidate the built crate whenever the wrapper changes
4343
println!("cargo:rerun-if-changed=bindings.h");
4444

45+
46+
// The bindgen::Builder is the main entry point
47+
// to bindgen, and lets you build up options for
48+
// the resulting bindings.
49+
let mut builder = bindgen::Builder::default();
50+
4551
// Set sdk to search path if SGX_SDK is in environment variable
46-
let mut sdk_inc = String::from("-I");
4752
if let Ok(val) = env::var("SGX_SDK") {
53+
let mut sdk_inc = String::from("-I");
4854
sdk_inc.push_str(&val);
4955
sdk_inc.push_str("/include/");
56+
// Include search path
57+
builder = builder.clang_arg(sdk_inc);
5058
}
5159

52-
// The bindgen::Builder is the main entry point
53-
// to bindgen, and lets you build up options for
54-
// the resulting bindings.
55-
let bindings = bindgen::Builder::default()
60+
let bindings = builder
5661
// The input header we would like to generate
5762
// bindings for.
5863
.header("bindings.h")
59-
// Include search path
60-
.clang_arg(sdk_inc)
6164
// Convert C enum to Rust enum
6265
.rustified_enum("_quote3_error_t")
6366
.rustified_enum("_sgx_ql_request_policy")

0 commit comments

Comments
 (0)