From 93d5672f5b7e19b0044e2408d334f30cfd476805 Mon Sep 17 00:00:00 2001 From: jh-block Date: Mon, 4 May 2026 16:36:13 +0200 Subject: [PATCH] Fix CRT linkage in Windows CUDA build (#8987) Signed-off-by: jh-block --- .github/workflows/build-cli.yml | 4 +- .github/workflows/bundle-desktop-windows.yml | 4 +- Cargo.lock | 161 ++++++++++++------- Cargo.toml | 1 + crates/goose/Cargo.toml | 12 +- 5 files changed, 114 insertions(+), 68 deletions(-) diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml index 9e944f3272..3b3923ff43 100644 --- a/.github/workflows/build-cli.yml +++ b/.github/workflows/build-cli.yml @@ -157,12 +157,10 @@ jobs: shell: pwsh env: CUDA_COMPUTE_CAP: ${{ matrix.variant == 'cuda' && '80' || '' }} - LLAMA_STATIC_CRT: ${{ matrix.variant == 'cuda' && '1' || '' }} run: | Write-Output "Building Windows CLI executable..." if ("${{ matrix.variant }}" -eq "cuda") { - $cudaRustflagsConfig = 'target.x86_64-pc-windows-msvc.rustflags=["-C","target-feature=+crt-static"]' - cargo build --config $cudaRustflagsConfig --release --target x86_64-pc-windows-msvc -p goose-cli --features cuda + cargo build --release --target x86_64-pc-windows-msvc -p goose-cli --features cuda } else { cargo build --release --target x86_64-pc-windows-msvc -p goose-cli } diff --git a/.github/workflows/bundle-desktop-windows.yml b/.github/workflows/bundle-desktop-windows.yml index b71fbde863..a07a50015e 100644 --- a/.github/workflows/bundle-desktop-windows.yml +++ b/.github/workflows/bundle-desktop-windows.yml @@ -112,12 +112,10 @@ jobs: shell: pwsh env: CUDA_COMPUTE_CAP: ${{ inputs.windows_variant == 'cuda' && '80' || '' }} - LLAMA_STATIC_CRT: ${{ inputs.windows_variant == 'cuda' && '1' || '' }} run: | Write-Output "Building Windows executable..." if ("${{ inputs.windows_variant }}" -eq "cuda") { - $cudaRustflagsConfig = 'target.x86_64-pc-windows-msvc.rustflags=["-C","target-feature=+crt-static"]' - cargo build --config $cudaRustflagsConfig --release --target x86_64-pc-windows-msvc -p goose-server --features cuda + cargo build --release --target x86_64-pc-windows-msvc -p goose-server --features cuda } else { cargo build --release --target x86_64-pc-windows-msvc -p goose-server } diff --git a/Cargo.lock b/Cargo.lock index b5379498e0..febf6e6f06 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]] @@ -1015,17 +1015,6 @@ dependencies = [ "syn 2.0.117", ] -[[package]] -name = "bindgen_cuda" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be55fb326843bb67cccceeeaf21c961ef303f60018f9a2ab69494dad8eaf9" -dependencies = [ - "glob", - "num_cpus", - "rayon", -] - [[package]] name = "biome_console" version = "0.3.1" @@ -1583,16 +1572,16 @@ dependencies = [ [[package]] name = "candle-core" -version = "0.9.2" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c15b675b80d994b2eadb20a4bbe434eabeb454eac3ee5e2b4cf6f147ee9be091" +checksum = "6bd9895436c1ba5dc1037a19935d084b838db066ff4e15ef7dded020b7c12a4a" dependencies = [ "byteorder", "candle-kernels", "candle-metal-kernels", "candle-ug", "cudarc 0.19.4", - "float8 0.6.1", + "float8", "gemm 0.19.0", "half", "libm", @@ -1606,24 +1595,25 @@ dependencies = [ "rayon", "safetensors 0.7.0", "thiserror 2.0.18", + "tokenizers 0.22.2", "yoke 0.8.1", "zip 7.2.0", ] [[package]] name = "candle-kernels" -version = "0.9.2" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8455f84bd810047c7c41216683c1020c915a9f8a740b3b0eabdd4fb2fbaa660" +checksum = "742e2ac226b777134436e9e692f44e77c278b8a7abb1554dc10e44dc911b349f" dependencies = [ - "bindgen_cuda", + "cudaforge", ] [[package]] name = "candle-metal-kernels" -version = "0.9.2" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fdfe9d06de16ce49961e49084e5b79a75a9bdf157246e7c7b6328e87a7aa25d" +checksum = "4b6b5a4cae6b4e1ab0efcee4dc05272d11b374a3d1ba121b3a961e36be54ab60" dependencies = [ "half", "objc2", @@ -1636,9 +1626,9 @@ dependencies = [ [[package]] name = "candle-nn" -version = "0.9.2" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3045fa9e7aef8567d209a27d56b692f60b96f4d0569f4c3011f8ca6715c65e03" +checksum = "a9317a09d6530b758990ed7f625ac69ff43653bc9ee28b0464644ad1169ada87" dependencies = [ "candle-core", "candle-metal-kernels", @@ -1654,9 +1644,9 @@ dependencies = [ [[package]] name = "candle-transformers" -version = "0.9.2" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b538ec4aa807c416a2ddd3621044888f188827862e2a6fcacba4738e89795d01" +checksum = "f59d08c89e9f4af9c464e2f3a8e16199e7cc601e6f34538c2cfbb42b623b1783" dependencies = [ "byteorder", "candle-core", @@ -1673,9 +1663,9 @@ dependencies = [ [[package]] name = "candle-ug" -version = "0.9.2" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c22d62be69068bf58987a45f690612739d8d2ea1bf508c1b87dc6815a019575d" +checksum = "ca0fc3167cbc99c8ec1be618cb620aa21dca95038f118c3579a79370e3dc5f77" dependencies = [ "ug", "ug-cuda", @@ -2391,6 +2381,24 @@ dependencies = [ "syn 2.0.117", ] +[[package]] +name = "cudaforge" +version = "0.1.6" +source = "git+https://github.com/jbg/cudaforge?rev=e7c1967340e40673db98dc9e17da0f04834a456f#e7c1967340e40673db98dc9e17da0f04834a456f" +dependencies = [ + "anyhow", + "fs2", + "glob", + "num_cpus", + "rayon", + "serde", + "serde_json", + "sha2", + "thiserror 2.0.18", + "walkdir", + "which 7.0.3", +] + [[package]] name = "cudarc" version = "0.17.8" @@ -2407,7 +2415,7 @@ version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f071cd6a7b5d51607df76aa2d426aaabc7a74bc6bdb885b8afa63a880572ad9b" dependencies = [ - "float8 0.7.0", + "float8", "half", "libloading 0.9.0", ] @@ -3157,7 +3165,7 @@ dependencies = [ "libc", "option-ext", "redox_users 0.5.2", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -3442,6 +3450,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bcb71a32ab9582e2756554e84b24aee90d7187034049c35921ec3296b70c13ad" +[[package]] +name = "env_home" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f84e12ccf0a7ddc17a6c41c93326024c42920d7ee630d04950e6926645c0fe" + [[package]] name = "equivalent" version = "1.0.2" @@ -3466,7 +3480,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]] @@ -3667,19 +3681,6 @@ dependencies = [ "zlib-rs", ] -[[package]] -name = "float8" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719a903cc23e4a89e87962c2a80fdb45cdaad0983a89bd150bb57b4c8571a7d5" -dependencies = [ - "cudarc 0.19.4", - "half", - "num-traits", - "rand 0.9.2", - "rand_distr", -] - [[package]] name = "float8" version = "0.7.0" @@ -3687,6 +3688,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2d1f04709a8ac06e8e8042875a3c466cc4832d3c1a18dbcb9dba3c6e83046bc" dependencies = [ "half", + "num-traits", + "rand 0.9.2", + "rand_distr", ] [[package]] @@ -4421,7 +4425,7 @@ dependencies = [ "test-case", "thiserror 1.0.69", "tiktoken-rs", - "tokenizers", + "tokenizers 0.21.4", "tokio", "tokio-cron-scheduler", "tokio-stream", @@ -5465,7 +5469,7 @@ dependencies = [ "portable-atomic", "portable-atomic-util", "serde_core", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -5840,9 +5844,9 @@ checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" [[package]] name = "llama-cpp-2" -version = "0.1.145" +version = "0.1.146" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e82b8c7a1c1a0ad97e1cc5cc28e01e9e14be73d4068e0fe9ac9d6c465001323" +checksum = "f3b0f368c76cc0fe475e8257aeeec269e0d6569bd48b1f503efd0963fc3ee397" dependencies = [ "encoding_rs", "enumflags2", @@ -5854,9 +5858,9 @@ dependencies = [ [[package]] name = "llama-cpp-sys-2" -version = "0.1.145" +version = "0.1.146" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1e5495433ca7487b9f8c7046f64e69937861d438b20f12ee3c524f35d55ad3" +checksum = "9b291e4bc2d10c43cd8dec16d49b6104cb3cb125f596ec380a753a5db1d965dd" dependencies = [ "bindgen", "cc", @@ -6279,7 +6283,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.59.0", ] [[package]] @@ -8235,7 +8239,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -8294,7 +8298,7 @@ dependencies = [ "security-framework 3.7.0", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -9099,7 +9103,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -10244,7 +10248,7 @@ dependencies = [ "getrandom 0.4.2", "once_cell", "rustix 1.1.4", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -10607,6 +10611,39 @@ dependencies = [ "unicode_categories", ] +[[package]] +name = "tokenizers" +version = "0.22.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b238e22d44a15349529690fb07bd645cf58149a1b1e44d6cb5bd1641ff1a6223" +dependencies = [ + "ahash", + "aho-corasick", + "compact_str 0.9.0", + "dary_heap", + "derive_builder", + "esaxx-rs", + "getrandom 0.3.4", + "itertools 0.14.0", + "log", + "macro_rules_attribute", + "monostate", + "onig", + "paste", + "rand 0.9.2", + "rayon", + "rayon-cond", + "regex", + "regex-syntax", + "serde", + "serde_json", + "spm_precompiled", + "thiserror 2.0.18", + "unicode-normalization-alignments", + "unicode-segmentation", + "unicode_categories", +] + [[package]] name = "tokio" version = "1.50.0" @@ -11826,6 +11863,18 @@ dependencies = [ "winsafe", ] +[[package]] +name = "which" +version = "7.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d643ce3fd3e5b54854602a080f34fb10ab75e0b813ee32d00ca2b44fa74762" +dependencies = [ + "either", + "env_home", + "rustix 1.1.4", + "winsafe", +] + [[package]] name = "which" version = "8.0.2" @@ -11867,7 +11916,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.59.0", ] [[package]] @@ -12369,7 +12418,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d6f32a0ff4a9f6f01231eb2059cc85479330739333e0e58cadf03b6af2cca10" dependencies = [ "cfg-if", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 8c25ee2fa5..757346bf31 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -98,6 +98,7 @@ tree-sitter-typescript = "0.23" [patch.crates-io] v8 = { path = "vendor/v8" } +cudaforge = { git = "https://github.com/jbg/cudaforge", rev = "e7c1967340e40673db98dc9e17da0f04834a456f" } # TODO: switch to crates.io release once it includes the unstable feature and updates org from symposium-dev to agentclientprotocol sacp = { git = "https://github.com/agentclientprotocol/symposium-acp", rev = "14086c9" } sacp-derive = { git = "https://github.com/agentclientprotocol/symposium-acp", rev = "14086c9" } diff --git a/crates/goose/Cargo.toml b/crates/goose/Cargo.toml index de2aaaa869..658626e6d4 100644 --- a/crates/goose/Cargo.toml +++ b/crates/goose/Cargo.toml @@ -151,9 +151,9 @@ sacp = { workspace = true, features = ["unstable"] } unicode-normalization = "0.1" # For local Whisper transcription (optional, behind "local-inference" feature) -candle-core = { version = "0.9", default-features = false, optional = true } -candle-nn = { version = "0.9", default-features = false, optional = true } -candle-transformers = { version = "0.9", default-features = false, optional = true } +candle-core = { version = "0.10.2", default-features = false, optional = true } +candle-nn = { version = "0.10.2", default-features = false, optional = true } +candle-transformers = { version = "0.10.2", default-features = false, optional = true } byteorder = { version = "1.5.0", optional = true } tokenizers = { version = "0.21.0", default-features = false, features = ["onig"], optional = true } symphonia = { version = "0.5", features = ["all"], optional = true } @@ -202,9 +202,9 @@ keyring = { version = "3.6.2", features = ["windows-native"] } # Platform-specific GPU acceleration for Whisper and local inference [target.'cfg(target_os = "macos")'.dependencies] -candle-core = { version = "0.9", default-features = false, features = ["metal"], optional = true } -candle-nn = { version = "0.9", default-features = false, features = ["metal"], optional = true } -llama-cpp-2 = { version = "0.1.143", features = ["sampler", "metal", "mtmd"], optional = true } +candle-core = { version = "0.10.2", default-features = false, features = ["metal"], optional = true } +candle-nn = { version = "0.10.2", default-features = false, features = ["metal"], optional = true } +llama-cpp-2 = { version = "0.1.145", features = ["sampler", "metal", "mtmd"], optional = true } keyring = { version = "3.6.2", features = ["apple-native"] } [target.'cfg(target_os = "linux")'.dependencies]