Skip to content

Commit 5663bfb

Browse files
committed
fixup! hvf: add Rust bindings
On MacOS, libclang.dylib does not usually know how to find the correct SDK. (There's an exception for Nix-installed libclang.dylibs, which is why this was working before). Use xcrun to set the sdk root so that we can find the hvf bindings. Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
1 parent 9f409ec commit 5663bfb

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/hyperlight_host/build.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,16 @@ fn main() -> Result<()> {
113113
"cargo:rerun-if-changed=src/hyperlight_host/src/hypervisor/virtual_machine/hvf/fp_abi.c"
114114
);
115115
println!("cargo:rustc-link-lib=framework=Hypervisor");
116+
let sdk_path = std::process::Command::new("xcrun")
117+
.args(["-sdk", "macosx", "-show-sdk-path"])
118+
.output()?
119+
.stdout;
120+
let sdk_path = String::from_utf8_lossy(&sdk_path);
121+
eprintln!("sdk path: {}", sdk_path.trim());
116122
bindgen::Builder::default()
117-
.clang_args(&["-framework", "Hypervisor"])
118123
.clang_args(&[
124+
"-isysroot",
125+
sdk_path.trim(),
119126
"-I",
120127
&format!("{manifest_dir}/src/hypervisor/virtual_machine/hvf"),
121128
])

0 commit comments

Comments
 (0)