diff --git a/Cargo.lock b/Cargo.lock index 059b0fd..e23aada 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -761,9 +761,9 @@ dependencies = [ [[package]] name = "lbug" -version = "0.17.1" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d38365ef5ebc0a55e342db7296a6ca9a2ee64916dbdbe4f87f1496b4fc68d0da" +checksum = "aba67c4a43a6dea1c12579a818dee3e2b44d0d80ca6eac700d992c7698cb462f" dependencies = [ "cmake", "cxx", diff --git a/Cargo.toml b/Cargo.toml index e9f0ece..0758f78 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ homepage = "https://github.com/rabii-chaarani/codebaseGraph" readme = "README.md" keywords = ["codebase", "graph", "mcp", "cli", "analysis"] categories = ["command-line-utilities", "development-tools"] -exclude = ["assets/ladybug-extensions/0.17.0/win_amd64/**"] +exclude = ["assets/ladybug-extensions/0.18.1/win_amd64/**"] [workspace] members = [".", "crates/k-wiki", "crates/xtask"] @@ -24,7 +24,7 @@ bundled-windows-extensions = [] [dependencies] fs2 = "0.4.3" -lbug = "0.17.1" +lbug = "0.18.3" notify = "8.2" serde = { version = "1", features = ["derive"] } serde_json = "1" diff --git a/assets/ladybug-extensions/0.17.0/linux_amd64/fts/libfts.lbug_extension b/assets/ladybug-extensions/0.17.0/linux_amd64/fts/libfts.lbug_extension deleted file mode 100644 index e76ba35..0000000 Binary files a/assets/ladybug-extensions/0.17.0/linux_amd64/fts/libfts.lbug_extension and /dev/null differ diff --git a/assets/ladybug-extensions/0.17.0/linux_arm64/fts/libfts.lbug_extension b/assets/ladybug-extensions/0.17.0/linux_arm64/fts/libfts.lbug_extension deleted file mode 100644 index 4c09e44..0000000 Binary files a/assets/ladybug-extensions/0.17.0/linux_arm64/fts/libfts.lbug_extension and /dev/null differ diff --git a/assets/ladybug-extensions/0.17.0/osx_amd64/fts/libfts.lbug_extension b/assets/ladybug-extensions/0.17.0/osx_amd64/fts/libfts.lbug_extension deleted file mode 100644 index 3815314..0000000 Binary files a/assets/ladybug-extensions/0.17.0/osx_amd64/fts/libfts.lbug_extension and /dev/null differ diff --git a/assets/ladybug-extensions/0.17.0/osx_arm64/fts/libfts.lbug_extension b/assets/ladybug-extensions/0.17.0/osx_arm64/fts/libfts.lbug_extension deleted file mode 100644 index af22aa5..0000000 Binary files a/assets/ladybug-extensions/0.17.0/osx_arm64/fts/libfts.lbug_extension and /dev/null differ diff --git a/assets/ladybug-extensions/0.17.0/osx_arm64/json/libjson.lbug_extension b/assets/ladybug-extensions/0.17.0/osx_arm64/json/libjson.lbug_extension deleted file mode 100644 index 77994c1..0000000 Binary files a/assets/ladybug-extensions/0.17.0/osx_arm64/json/libjson.lbug_extension and /dev/null differ diff --git a/assets/ladybug-extensions/0.18.1/linux_amd64/fts/libfts.lbug_extension b/assets/ladybug-extensions/0.18.1/linux_amd64/fts/libfts.lbug_extension new file mode 100644 index 0000000..0971ff0 Binary files /dev/null and b/assets/ladybug-extensions/0.18.1/linux_amd64/fts/libfts.lbug_extension differ diff --git a/assets/ladybug-extensions/0.17.0/linux_amd64/json/libjson.lbug_extension b/assets/ladybug-extensions/0.18.1/linux_amd64/json/libjson.lbug_extension similarity index 99% rename from assets/ladybug-extensions/0.17.0/linux_amd64/json/libjson.lbug_extension rename to assets/ladybug-extensions/0.18.1/linux_amd64/json/libjson.lbug_extension index 73a0c4a..b6b149b 100644 Binary files a/assets/ladybug-extensions/0.17.0/linux_amd64/json/libjson.lbug_extension and b/assets/ladybug-extensions/0.18.1/linux_amd64/json/libjson.lbug_extension differ diff --git a/assets/ladybug-extensions/0.18.1/linux_arm64/fts/libfts.lbug_extension b/assets/ladybug-extensions/0.18.1/linux_arm64/fts/libfts.lbug_extension new file mode 100644 index 0000000..41f2fa5 Binary files /dev/null and b/assets/ladybug-extensions/0.18.1/linux_arm64/fts/libfts.lbug_extension differ diff --git a/assets/ladybug-extensions/0.17.0/linux_arm64/json/libjson.lbug_extension b/assets/ladybug-extensions/0.18.1/linux_arm64/json/libjson.lbug_extension similarity index 99% rename from assets/ladybug-extensions/0.17.0/linux_arm64/json/libjson.lbug_extension rename to assets/ladybug-extensions/0.18.1/linux_arm64/json/libjson.lbug_extension index f6de7bd..764f46d 100644 Binary files a/assets/ladybug-extensions/0.17.0/linux_arm64/json/libjson.lbug_extension and b/assets/ladybug-extensions/0.18.1/linux_arm64/json/libjson.lbug_extension differ diff --git a/assets/ladybug-extensions/0.18.1/osx_amd64/fts/libfts.lbug_extension b/assets/ladybug-extensions/0.18.1/osx_amd64/fts/libfts.lbug_extension new file mode 100644 index 0000000..b0fd3b7 Binary files /dev/null and b/assets/ladybug-extensions/0.18.1/osx_amd64/fts/libfts.lbug_extension differ diff --git a/assets/ladybug-extensions/0.17.0/osx_amd64/json/libjson.lbug_extension b/assets/ladybug-extensions/0.18.1/osx_amd64/json/libjson.lbug_extension similarity index 100% rename from assets/ladybug-extensions/0.17.0/osx_amd64/json/libjson.lbug_extension rename to assets/ladybug-extensions/0.18.1/osx_amd64/json/libjson.lbug_extension diff --git a/assets/ladybug-extensions/0.18.1/osx_arm64/fts/libfts.lbug_extension b/assets/ladybug-extensions/0.18.1/osx_arm64/fts/libfts.lbug_extension new file mode 100644 index 0000000..31f85a0 Binary files /dev/null and b/assets/ladybug-extensions/0.18.1/osx_arm64/fts/libfts.lbug_extension differ diff --git a/assets/ladybug-extensions/0.18.1/osx_arm64/json/libjson.lbug_extension b/assets/ladybug-extensions/0.18.1/osx_arm64/json/libjson.lbug_extension new file mode 100644 index 0000000..1bc9aa3 Binary files /dev/null and b/assets/ladybug-extensions/0.18.1/osx_arm64/json/libjson.lbug_extension differ diff --git a/assets/ladybug-extensions/0.17.0/win_amd64/fts/libfts.lbug_extension b/assets/ladybug-extensions/0.18.1/win_amd64/fts/libfts.lbug_extension similarity index 66% rename from assets/ladybug-extensions/0.17.0/win_amd64/fts/libfts.lbug_extension rename to assets/ladybug-extensions/0.18.1/win_amd64/fts/libfts.lbug_extension index 3c2dec4..093f8b7 100644 Binary files a/assets/ladybug-extensions/0.17.0/win_amd64/fts/libfts.lbug_extension and b/assets/ladybug-extensions/0.18.1/win_amd64/fts/libfts.lbug_extension differ diff --git a/assets/ladybug-extensions/0.17.0/win_amd64/json/libjson.lbug_extension b/assets/ladybug-extensions/0.18.1/win_amd64/json/libjson.lbug_extension similarity index 66% rename from assets/ladybug-extensions/0.17.0/win_amd64/json/libjson.lbug_extension rename to assets/ladybug-extensions/0.18.1/win_amd64/json/libjson.lbug_extension index 38d365d..3edd547 100644 Binary files a/assets/ladybug-extensions/0.17.0/win_amd64/json/libjson.lbug_extension and b/assets/ladybug-extensions/0.18.1/win_amd64/json/libjson.lbug_extension differ diff --git a/build.rs b/build.rs index 5937da4..059c4ad 100644 --- a/build.rs +++ b/build.rs @@ -24,4 +24,37 @@ fn main() { println!("cargo:rustc-link-search=native={}", path.display()); } } + + if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("macos") + && std::env::var("CARGO_CFG_TARGET_ARCH").as_deref() == Ok("x86_64") + { + link_macos_x86_compiler_runtime(); + } +} + +fn link_macos_x86_compiler_runtime() { + println!("cargo:rerun-if-env-changed=DEVELOPER_DIR"); + let output = std::process::Command::new("xcrun") + .args(["clang", "--print-resource-dir"]) + .output() + .expect("macOS x86_64 builds require xcrun and clang"); + assert!( + output.status.success(), + "xcrun clang --print-resource-dir failed with {}", + output.status + ); + + let resource_dir = + String::from_utf8(output.stdout).expect("clang resource directory must be valid UTF-8"); + let library_dir = std::path::Path::new(resource_dir.trim()) + .join("lib") + .join("darwin"); + let runtime = library_dir.join("libclang_rt.osx.a"); + assert!( + runtime.is_file(), + "macOS compiler runtime not found at {}", + runtime.display() + ); + println!("cargo:rustc-link-search=native={}", library_dir.display()); + println!("cargo:rustc-link-lib=static=clang_rt.osx"); } diff --git a/knowledge/memory/procedural/ladybug-0183-link-and-extension-alignment-2026-08-14.md b/knowledge/memory/procedural/ladybug-0183-link-and-extension-alignment-2026-08-14.md new file mode 100644 index 0000000..7db6f1b --- /dev/null +++ b/knowledge/memory/procedural/ladybug-0183-link-and-extension-alignment-2026-08-14.md @@ -0,0 +1,49 @@ +--- +agent_memory: + version: 1 + kind: procedural + scope: repository + status: active + owner: codex + created_at: 2026-08-14T15:05:00+09:30 + last_verified_at: 2026-08-14T15:06:00+09:30 + verified_by: codex + review_after: null + supersedes: + - ladybug-release-extension-cache-variants-2026-08-13 + superseded_by: null + sources: + - kind: ci-log + reference: GitHub Actions run 31770156177 job 94674205658 + content_hash: null + - kind: source + reference: Cargo.toml and Cargo.lock pin lbug 0.18.3 + content_hash: null + - kind: source + reference: lbug 0.18.3 build.rs removes bundled component relinking and bundled CMakeLists.txt declares LBUG_EXTENSION_VERSION=0.18.1 + content_hash: null + - kind: test + reference: db_writer::extensions::tests::supports_prebuilt_and_source_built_ladybug_extension_cache_versions + content_hash: null + - kind: test + reference: db_writer::tests::native_writer_loads_json_staging_through_ladybug_copy and adapters::cli::tests::graph::graph_search_reads_native_fts_indexes + content_hash: null + history: + - from: candidate + to: active + actor: codex + at: 2026-08-14T15:06:00+09:30 + reason: Verified against the failing CI linker command, the lbug 0.17.1 and 0.18.3 build scripts, the 0.18.3 bundled CMake extension version, official 0.18.1 extension binaries, a successful crates.io dry-run, and passing JSON/FTS runtime tests. +description: lbug 0.18.3 fixes the 0.17.1 source-link fallback but requires matching 0.18.1 extension binaries and cache paths. +tags: +- ci +- crates-io +- extensions +- ladybug +- linker +- release +timestamp: 2026-08-14T15:05:00+09:30 +title: Align Ladybug source linking and extension ABI when upgrading lbug +type: agent-memory +--- +When `cargo publish --dry-run` verifies the crates.io tarball without an external `LBUG_LIBRARY_DIR`, `lbug 0.17.1` can fall back to a source build that whole-archives both `liblbug.a` and its component archives, producing duplicate symbols. Upgrade to `lbug 0.18.3` or later with the source-link fix, and keep its native extension ABI aligned: the bundled Ladybug source in 0.18.3 declares `LBUG_EXTENSION_VERSION=0.18.1`, so vendored JSON/FTS binaries and the seeded `.lbdb/extension/0.18.1/` paths must come from the official 0.18.1 extension repository. Never copy older extension bytes into the new cache directory; JSON may appear to work while FTS fails at load time with unresolved C++ symbols. Verify both `cargo publish --dry-run --locked` and focused JSON/FTS runtime tests after the upgrade. \ No newline at end of file diff --git a/knowledge/memory/procedural/ladybug-macos-x86-compiler-runtime-2026-08-14.md b/knowledge/memory/procedural/ladybug-macos-x86-compiler-runtime-2026-08-14.md new file mode 100644 index 0000000..e635e9c --- /dev/null +++ b/knowledge/memory/procedural/ladybug-macos-x86-compiler-runtime-2026-08-14.md @@ -0,0 +1,42 @@ +--- +agent_memory: + version: 1 + kind: procedural + scope: repository + status: active + owner: codex + created_at: 2026-08-14T15:42:00+09:30 + last_verified_at: 2026-08-14T15:43:00+09:30 + verified_by: codex + review_after: null + supersedes: [] + superseded_by: null + sources: + - kind: ci-log + reference: GitHub Actions run 31773525988 job 94684123400, undefined ___cpu_model on macos-x86_64 + content_hash: null + - kind: source + reference: build.rs link_macos_x86_compiler_runtime + content_hash: null + - kind: ci-log + reference: GitHub Actions run 31774057855, all native targets and required check successful + content_hash: null + history: + - from: candidate + to: active + actor: codex + at: 2026-08-14T15:43:00+09:30 + reason: Verified against the failed macOS Intel linker command and the subsequent hosted CI run where macOS Intel, Linux, Apple Silicon, Windows, publish verification, and the required aggregate all succeeded. +description: Ladybug's macOS x86 static archive needs LLVM's CPU-model runtime in Rust's nodefaultlibs final link. +tags: +- ci +- ladybug +- linker +- macos +- release +- x86_64 +timestamp: 2026-08-14T15:42:00+09:30 +title: Link LLVM compiler runtime for Ladybug on macOS Intel +type: agent-memory +--- +When linking the prebuilt Ladybug 0.18.3 static archive for `x86_64-apple-darwin`, the archive can reference `__cpu_model`. Rust invokes the final C linker with `-nodefaultlibs`, so Clang does not automatically add the compiler runtime and the native artifact build fails with an undefined `___cpu_model` symbol. For macOS x86_64 only, resolve the active Clang resource directory through `xcrun clang --print-resource-dir`, add its `lib/darwin` directory to the native link search, and statically link `libclang_rt.osx.a`. Do not add this link to Linux, Apple Silicon, or Windows. Verify the repair with the hosted `macos-x86_64` native artifact build and smoke test, then confirm every other native matrix target remains green. \ No newline at end of file diff --git a/knowledge/memory/procedural/ladybug-release-extension-cache-variants-2026-08-13.md b/knowledge/memory/procedural/ladybug-release-extension-cache-variants-2026-08-13.md index cc49db7..f97c777 100644 --- a/knowledge/memory/procedural/ladybug-release-extension-cache-variants-2026-08-13.md +++ b/knowledge/memory/procedural/ladybug-release-extension-cache-variants-2026-08-13.md @@ -3,14 +3,14 @@ agent_memory: version: 1 kind: procedural scope: repository - status: active + status: superseded owner: codex created_at: 2026-08-13T00:00:00+09:30 last_verified_at: 2026-08-13T00:00:00+09:30 verified_by: codex review_after: null supersedes: [] - superseded_by: null + superseded_by: ladybug-0183-link-and-extension-alignment-2026-08-14 sources: - kind: commit reference: 'ba7ed2f fix(release): seed both Ladybug extension caches' @@ -33,6 +33,11 @@ agent_memory: actor: codex at: 2026-08-13T00:00:00+09:30 reason: Verified against the distinct 0.19.0 source-built and 0.17.0 prebuilt Ladybug cache requests in the failing logs, and the successful Ubuntu and Windows native-package smoke tests in run 31671399427. + - from: active + to: superseded + actor: codex + at: 2026-08-14T15:07:00+09:30 + reason: The repository now uses lbug 0.18.3 consistently for source and prebuilt modes, so both require ABI-compatible 0.18.1 extension binaries instead of seeding 0.17.0 and 0.19.0 copies. description: Prebuilt and source-built Ladybug libraries can resolve the same bundled extensions from different cache-version paths. tags: - ci diff --git a/src/db_writer/extensions.rs b/src/db_writer/extensions.rs index 45e77f9..10bc4b0 100644 --- a/src/db_writer/extensions.rs +++ b/src/db_writer/extensions.rs @@ -1,11 +1,10 @@ use crate::error::NativeError; use std::path::{Path, PathBuf}; -// Prebuilt Ladybug 0.17.x libraries look in the 0.17.0 cache, while the -// source-built release library resolves the same extensions from 0.19.0. -// Seed both compatible cache locations so packaged binaries never download -// extensions at runtime. -const LADYBUG_EXTENSION_CACHE_VERSIONS: [&str; 2] = ["0.17.0", "0.19.0"]; +// Both the prebuilt and source-built Ladybug 0.18.3 libraries resolve +// extensions from this ABI-compatible cache path. Seed it so packaged +// binaries never download extensions at runtime. +const LADYBUG_EXTENSION_CACHE_VERSIONS: [&str; 1] = ["0.18.1"]; pub fn preseed_ladybug_extensions(include_fts: bool) -> Result<(), NativeError> { let home = ladybug_home_dir()?; @@ -73,10 +72,10 @@ fn ladybug_platform() -> Option<&'static str> { fn bundled_extension_bytes(extension: &str) -> Option<&'static [u8]> { match extension { "json" => Some(include_bytes!( - "../../assets/ladybug-extensions/0.17.0/linux_amd64/json/libjson.lbug_extension" + "../../assets/ladybug-extensions/0.18.1/linux_amd64/json/libjson.lbug_extension" )), "fts" => Some(include_bytes!( - "../../assets/ladybug-extensions/0.17.0/linux_amd64/fts/libfts.lbug_extension" + "../../assets/ladybug-extensions/0.18.1/linux_amd64/fts/libfts.lbug_extension" )), _ => None, } @@ -86,10 +85,10 @@ fn bundled_extension_bytes(extension: &str) -> Option<&'static [u8]> { fn bundled_extension_bytes(extension: &str) -> Option<&'static [u8]> { match extension { "json" => Some(include_bytes!( - "../../assets/ladybug-extensions/0.17.0/linux_arm64/json/libjson.lbug_extension" + "../../assets/ladybug-extensions/0.18.1/linux_arm64/json/libjson.lbug_extension" )), "fts" => Some(include_bytes!( - "../../assets/ladybug-extensions/0.17.0/linux_arm64/fts/libfts.lbug_extension" + "../../assets/ladybug-extensions/0.18.1/linux_arm64/fts/libfts.lbug_extension" )), _ => None, } @@ -99,10 +98,10 @@ fn bundled_extension_bytes(extension: &str) -> Option<&'static [u8]> { fn bundled_extension_bytes(extension: &str) -> Option<&'static [u8]> { match extension { "json" => Some(include_bytes!( - "../../assets/ladybug-extensions/0.17.0/osx_amd64/json/libjson.lbug_extension" + "../../assets/ladybug-extensions/0.18.1/osx_amd64/json/libjson.lbug_extension" )), "fts" => Some(include_bytes!( - "../../assets/ladybug-extensions/0.17.0/osx_amd64/fts/libfts.lbug_extension" + "../../assets/ladybug-extensions/0.18.1/osx_amd64/fts/libfts.lbug_extension" )), _ => None, } @@ -112,10 +111,10 @@ fn bundled_extension_bytes(extension: &str) -> Option<&'static [u8]> { fn bundled_extension_bytes(extension: &str) -> Option<&'static [u8]> { match extension { "json" => Some(include_bytes!( - "../../assets/ladybug-extensions/0.17.0/osx_arm64/json/libjson.lbug_extension" + "../../assets/ladybug-extensions/0.18.1/osx_arm64/json/libjson.lbug_extension" )), "fts" => Some(include_bytes!( - "../../assets/ladybug-extensions/0.17.0/osx_arm64/fts/libfts.lbug_extension" + "../../assets/ladybug-extensions/0.18.1/osx_arm64/fts/libfts.lbug_extension" )), _ => None, } @@ -129,10 +128,10 @@ fn bundled_extension_bytes(extension: &str) -> Option<&'static [u8]> { fn bundled_extension_bytes(extension: &str) -> Option<&'static [u8]> { match extension { "json" => Some(include_bytes!( - "../../assets/ladybug-extensions/0.17.0/win_amd64/json/libjson.lbug_extension" + "../../assets/ladybug-extensions/0.18.1/win_amd64/json/libjson.lbug_extension" )), "fts" => Some(include_bytes!( - "../../assets/ladybug-extensions/0.17.0/win_amd64/fts/libfts.lbug_extension" + "../../assets/ladybug-extensions/0.18.1/win_amd64/fts/libfts.lbug_extension" )), _ => None, } @@ -160,17 +159,10 @@ mod tests { #[test] fn supports_prebuilt_and_source_built_ladybug_extension_cache_versions() { + assert_eq!(super::LADYBUG_EXTENSION_CACHE_VERSIONS, ["0.18.1"]); assert_eq!( - super::LADYBUG_EXTENSION_CACHE_VERSIONS, - ["0.17.0", "0.19.0"] - ); - assert_eq!( - extension_dir(Path::new("cache"), "0.17.0", "win_amd64", "json"), - PathBuf::from("cache/.lbdb/extension/0.17.0/win_amd64/json") - ); - assert_eq!( - extension_dir(Path::new("cache"), "0.19.0", "linux_amd64", "json"), - PathBuf::from("cache/.lbdb/extension/0.19.0/linux_amd64/json") + extension_dir(Path::new("cache"), "0.18.1", "osx_arm64", "json"), + PathBuf::from("cache/.lbdb/extension/0.18.1/osx_arm64/json") ); } }