From fc292c73eca3947f3158ace5e8b08b82b72858de Mon Sep 17 00:00:00 2001 From: jh-block Date: Wed, 25 Feb 2026 23:59:32 +0100 Subject: [PATCH] Fix Windows MSVC linking issues (#7511) --- .cargo/config.toml | 5 ++++ Cargo.lock | 51 +++++++++++++++++++++-------------------- Cargo.toml | 4 ++++ crates/goose/Cargo.toml | 6 ++--- vendor/v8/Cargo.toml | 15 ++++++++++++ vendor/v8/src/lib.rs | 1 + 6 files changed, 54 insertions(+), 28 deletions(-) create mode 100644 .cargo/config.toml create mode 100644 vendor/v8/Cargo.toml create mode 100644 vendor/v8/src/lib.rs diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000000..8bf45fb405 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,5 @@ +[target.x86_64-pc-windows-msvc] +rustflags = ["-C", "link-args=/FORCE:MULTIPLE"] + +[target.aarch64-pc-windows-msvc] +rustflags = ["-C", "link-args=/FORCE:MULTIPLE"] diff --git a/Cargo.lock b/Cargo.lock index 4310f13626..badf42c536 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -140,7 +140,7 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -151,7 +151,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -1742,9 +1742,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.55" +version = "1.2.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29" +checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2" dependencies = [ "find-msvc-tools", "jobserver", @@ -1956,7 +1956,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" dependencies = [ "lazy_static", - "windows-sys 0.59.0", + "windows-sys 0.48.0", ] [[package]] @@ -3125,7 +3125,7 @@ dependencies = [ "libc", "option-ext", "redox_users 0.5.2", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -3417,7 +3417,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -3431,9 +3431,6 @@ name = "esaxx-rs" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d817e038c30374a4bcb22f94d0a8a0e216958d4c3dcde369b1439fec4bdda6e6" -dependencies = [ - "cc", -] [[package]] name = "etcetera" @@ -5467,7 +5464,7 @@ dependencies = [ "portable-atomic", "portable-atomic-util", "serde_core", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -5782,23 +5779,21 @@ checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" [[package]] name = "llama-cpp-2" -version = "0.1.133" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "888c8805527f4c35ec16f26003d54a318cde1629e7439da8e9ef2d6d3883e106" +version = "0.1.136" +source = "git+https://github.com/jh-block/llama-cpp-rs.git?branch=goose-patches#09f48aefc28b74cd28a1cfe12071b17990ed9835" dependencies = [ "encoding_rs", "enumflags2", "llama-cpp-sys-2", - "thiserror 1.0.69", + "thiserror 2.0.18", "tracing", "tracing-core", ] [[package]] name = "llama-cpp-sys-2" -version = "0.1.133" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a180dfa6d6f9d1df1e031bcdf0464bbad4f9b326395bfd28f2fa539d8cbc9c2b" +version = "0.1.136" +source = "git+https://github.com/jh-block/llama-cpp-rs.git?branch=goose-patches#09f48aefc28b74cd28a1cfe12071b17990ed9835" dependencies = [ "bindgen", "cc", @@ -6224,7 +6219,7 @@ version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -8421,7 +8416,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.11.0", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -8501,7 +8496,7 @@ dependencies = [ "security-framework 3.5.1", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -10287,7 +10282,7 @@ dependencies = [ "getrandom 0.4.1", "once_cell", "rustix 1.1.3", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -10610,7 +10605,6 @@ dependencies = [ "derive_builder", "esaxx-rs", "getrandom 0.3.4", - "indicatif 0.17.11", "itertools 0.14.0", "log", "macro_rules_attribute", @@ -11469,8 +11463,15 @@ dependencies = [ [[package]] name = "v8" version = "145.0.0" +dependencies = [ + "v8-goose", +] + +[[package]] +name = "v8-goose" +version = "145.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61d9a107e16bae35a0be2bb0096ac1d2318aac352c82edd796ab2b9cac66d8f0" +checksum = "6f84468f393984251db025e944544590a8fb429d5088b78102bd72f09232f0da" dependencies = [ "bindgen", "bitflags 2.10.0", @@ -11827,7 +11828,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.48.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 6f8fee004e..2dd52fd23a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,3 +68,7 @@ opentelemetry-otlp = "0.31" opentelemetry-appender-tracing = "0.31" opentelemetry-stdout = { version = "0.31", features = ["trace", "metrics", "logs"] } tracing-opentelemetry = "0.32" + + +[patch.crates-io] +v8 = { path = "vendor/v8" } diff --git a/crates/goose/Cargo.toml b/crates/goose/Cargo.toml index 4626d52311..1c9b3e89bc 100644 --- a/crates/goose/Cargo.toml +++ b/crates/goose/Cargo.toml @@ -107,7 +107,7 @@ candle-core = { version = "0.9", default-features = false } candle-nn = { version = "0.9", default-features = false } candle-transformers = { version = "0.9", default-features = false } byteorder = "1.5.0" -tokenizers = "0.21.0" +tokenizers = { version = "0.21.0", default-features = false, features = ["onig"] } hf-hub = { version = "0.4.3", default-features = false, features = ["tokio"] } symphonia = { version = "0.5", features = ["all"] } rubato = "0.16" @@ -127,7 +127,7 @@ which = { workspace = true } pctx_code_mode = "^0.2.3" unbinder = "0.1.7" pulldown-cmark = "0.13.0" -llama-cpp-2 = { version = "0.1.133", features = ["sampler"] } +llama-cpp-2 = { git = "https://github.com/jh-block/llama-cpp-rs.git", branch = "goose-patches", features = ["sampler"] } encoding_rs = "0.8.35" [target.'cfg(target_os = "windows")'.dependencies] @@ -137,7 +137,7 @@ winapi = { version = "0.3", features = ["wincred"] } [target.'cfg(target_os = "macos")'.dependencies] candle-core = { version = "0.9", default-features = false, features = ["metal"] } candle-nn = { version = "0.9", default-features = false, features = ["metal"] } -llama-cpp-2 = { version = "0.1.133", features = ["sampler", "metal"] } +llama-cpp-2 = { git = "https://github.com/jh-block/llama-cpp-rs.git", branch = "goose-patches", features = ["sampler", "metal"] } [dev-dependencies] serial_test = { workspace = true } diff --git a/vendor/v8/Cargo.toml b/vendor/v8/Cargo.toml new file mode 100644 index 0000000000..51f42cb82d --- /dev/null +++ b/vendor/v8/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "v8" +version = "145.0.0" +edition = "2024" +publish = false + +[features] +default = ["use_custom_libcxx"] +use_custom_libcxx = ["v8-goose/use_custom_libcxx"] +v8_enable_pointer_compression = ["v8-goose/v8_enable_pointer_compression"] +v8_enable_sandbox = ["v8-goose/v8_enable_sandbox"] +v8_enable_v8_checks = ["v8-goose/v8_enable_v8_checks"] + +[dependencies] +v8-goose = { version = "145.0.2" } diff --git a/vendor/v8/src/lib.rs b/vendor/v8/src/lib.rs new file mode 100644 index 0000000000..f9e0a283ed --- /dev/null +++ b/vendor/v8/src/lib.rs @@ -0,0 +1 @@ +pub use v8_goose::*;