Skip to content

Conversation

@qnixsynapse
Copy link
Contributor

Describe Your Changes

Ensure that the backend executable’s directory is added to the appropriate environment variable (PATH, LD_LIBRARY_PATH, or DYLD_LIBRARY_PATH) before invoking llama_load and get_devices.
This change fixes load failures on Windows, Linux, and macOS where the dynamic loader cannot locate the required libraries without the proper search paths, and cleans up unused imports.

Fixes Issues

  • Closes #
  • Closes #

Self Checklist

  • Added relevant comments, esp in complex areas
  • Updated docs (for bug fixes / features)
  • Created issues for follow-up changes or refactoring needed

Ensure that the backend executable’s directory is added to the appropriate
environment variable (`PATH`, `LD_LIBRARY_PATH`, or `DYLD_LIBRARY_PATH`)
before invoking `llama_load` and `get_devices`.
This change fixes load failures on Windows, Linux, and macOS where the
dynamic loader cannot locate the required libraries without the proper
search paths, and cleans up unused imports.
@github-actions
Copy link
Contributor

github-actions bot commented Nov 12, 2025

Barecheck - Code coverage report

Total: 29.99%

Your code coverage diff: -0.02% ▾

✅ All code changes are covered

Copy link
Contributor

@louis-jan louis-jan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Move the library‑path configuration logic out of the TypeScript code into the
Rust `setup_library_path` helper. The TypeScript files no longer set the
`PATH`, `LD_LIBRARY_PATH`, or `DYLD_LIBRARY_PATH` environment variables
directly; instead they defer to the Rust side, which now accepts a
`Path` and performs platform‑specific normalization (including UNC‑prefix
trimming on Windows). This removes duplicated code, keeps environment
configuration consistent across the plugin, and simplifies maintenance.
The import order in `device.rs` was corrected and small formatting fixes
were applied. No functional changes to the public API occur.
Add utilities to detect CUDA installations on Windows and Linux, automatically
inject CUDA paths into the process environment, and warn when the llama.cpp
binary requires CUDA but the runtime is not found.  The library‑path setup has
been refactored to prepend new paths and normalise UNC prefixes for Windows.
This ensures the backend can load CUDA libraries correctly and provides
diagnostic information when CUDA is missing.
This update unifies backend type handling across the llamacpp extension.
Previously, the stored backend preference, the version string, and the
auto‑update logic used inconsistent identifiers (raw backend names versus
their effective mapped forms). The patch:

* Maps legacy backend names to their new “effective” type before any
comparison or storage.
* Stores the full `version/effectiveType` string instead of just the
type, ensuring the configuration and localStorage stay in sync.
* Updates all logging and warning messages to reference the effective
backend type.
* Simplifies the update check logic by comparing the effective type and
version together, preventing unnecessary migrations.

These changes eliminate bugs that occurred when the backend type
changed after an update and make the internal state more coherent.
Enhance `_isCudaInstalled` to accept the backend directory and CUDA version, checking both the new and legacy installation paths. If a library is found in the old location, move it to the new `build/bin` directory and create any missing folders. Update `mapOldBackendToNew` formatting and remove duplicated comments. Minor consistency and readability fixes were also applied throughout the backend module.
This update expands the regular expression used to parse llama‑cpp extension archives.
The new pattern now supports:
- Optional prefixes and the `-main` segment
- Version strings that include a hash suffix
- An optional `-cudart-llama` part
- A wide range of backend detail strings

These changes ensure `installBackend` can correctly handle the latest naming conventions (e.g., `k_llama-main-b4314-09c61e1-bin-win-cuda-12.8-x64-avx2.zip`) while preserving backward compatibility with older formats.
@qnixsynapse qnixsynapse merged commit 2af5ab9 into release/v0.7.3 Nov 13, 2025
13 checks passed
@qnixsynapse qnixsynapse deleted the fix/llamacpp_load_missing_dll branch November 13, 2025 03:43
@github-actions github-actions bot added this to the v0.7.4 milestone Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants