Skip to content

armgit / kokon

Public Imported from GitHub
0

Edit photos by describing the change, on your own GPU. A free, open-source alternative to Nano Banana and ChatGPT image editing: photos stay on your computer, no daily limit. One installer for Windows, Mac and Linux sets up the best open model (Qwen-Image 2.1). MCP server for AI agents.

Mac release build: link clang's runtime for ONNX Runtime's CoreML code

Gabriele Lozupone576375171719
diff --git a/crates/qls-core/build.rs b/crates/qls-core/build.rs
new file mode 100644
index 0000000..b8e6592
--- /dev/null
+++ b/crates/qls-core/build.rs
@@ -0,0 +1,18 @@
+// macOS: ONNX Runtime's CoreML code (in the static runtime `ort` downloads for the Mac) calls
+// `___isPlatformVersionAtLeast` (Objective-C `@available`), which lives in clang's runtime library.
+// The release build (thin LTO) did not get it and every binary with qls-core failed to link
+// (0.12.0, 2026-11-04; dev builds linked). Linking libclang_rt.osx.a from the toolchain fixes it.
+fn main() {
+ println!("cargo:rerun-if-changed=build.rs");
+ if std::env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("macos") {
+ return;
+ }
+ let Ok(out) = std::process::Command::new("clang").arg("--print-runtime-dir").output() else { return };
+ let dir = String::from_utf8_lossy(&out.stdout).trim().to_string();
+ if std::path::Path::new(&dir).join("libclang_rt.osx.a").is_file() {
+ println!("cargo:rustc-link-search=native={dir}");
+ println!("cargo:rustc-link-lib=static=clang_rt.osx");
+ } else {
+ println!("cargo:warning=libclang_rt.osx.a not found in {dir}: a release build may fail to link ONNX Runtime");
+ }
+}