- Build System: Changed default library type from dynamic to static
- Default builds now produce static libraries (.a files)
- Shared libraries are only built when the
dynamic-linkfeature is explicitly enabled - Backend features (cuda, metal, blas, vulkan, etc.) no longer force shared library builds
- The
dynamic-linkfeature can be combined with any backend feature to produce shared libraries - Environment variable
LLAMA_BUILD_SHARED_LIBScan override the default behavior
This change maintains backward compatibility for most use cases:
- Applications using default builds will now get static libraries instead of dynamic ones
- Applications explicitly using the
dynamic-linkfeature will continue to work as before - All backend features (cuda, metal, blas, etc.) continue to work as expected
- The
LLAMA_BUILD_SHARED_LIBSenvironment variable provides an escape hatch for special requirements
If you were relying on the old behavior (dynamic libraries by default):
-
Explicitly enable dynamic-link feature:
cargo build --features dynamic-link
-
Or set the environment variable:
LLAMA_BUILD_SHARED_LIBS=1 cargo build
-
For Cargo.toml:
[dependencies.llama-cpp-sys-4] version = "0.2.43" features = ["dynamic-link"]
- Smaller distribution size: Static libraries are self-contained
- Easier deployment: No need to manage separate .dylib/.so files
- Better compatibility: Static linking avoids library version conflicts
- Explicit control: Developers can choose the linking strategy that best fits their needs