Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: build.rs metallib path — use ancestors().nth(2) for build/ dir

Louis Beaumont2e0308edac81
diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
index fe21640d8..007a944fe 100644
--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "2.2.278"
+version = "2.2.279"
description = "24/7 memory for your desktop. 100% local."
authors = ["you"]
license = ""
diff --git a/apps/screenpipe-app-tauri/src-tauri/build.rs b/apps/screenpipe-app-tauri/src-tauri/build.rs
index 6fe2c8fc2..485c6b986 100644
--- a/apps/screenpipe-app-tauri/src-tauri/build.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/build.rs
@@ -366,12 +366,17 @@ fn main() {
let out_dir = std::env::var("OUT_DIR").unwrap_or_default();
// Navigate from OUT_DIR (target/{profile}/build/{crate}-{hash}/out/)
// up to the build/ dir to find mlx-sys's metallib
- if let Some(build_dir) = std::path::Path::new(&out_dir).ancestors().nth(3) {
+ // OUT_DIR is target/{target}/release/build/{crate}-{hash}/out/
+ // We need the build/ dir which is 2 levels up
+ if let Some(build_dir) = std::path::Path::new(&out_dir).ancestors().nth(2) {
let mut found = false;
if let Ok(entries) = std::fs::read_dir(build_dir) {
for entry in entries.flatten() {
if entry.file_name().to_string_lossy().starts_with("mlx-sys-") {
- let metallib = entry.path().join("out/build/_deps/mlx-build/mlx/backend/metal/kernels/mlx.metallib");
+ // metallib can be at either path depending on cmake config
+ let base = entry.path().join("out/build");
+ let metallib = base.join("_deps/mlx-build/mlx/backend/metal/kernels/mlx.metallib");
+ let metallib = if metallib.exists() { metallib } else { base.join("lib/mlx.metallib") };
if metallib.exists() {
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
let dest = std::path::Path::new(&manifest_dir).join("mlx.metallib");