Skip to content

docker/unified: build llama.cpp with static libraries#616

Merged
mostlygeek merged 1 commit intomainfrom
docker-unified-static-builds
Mar 31, 2026
Merged

docker/unified: build llama.cpp with static libraries#616
mostlygeek merged 1 commit intomainfrom
docker-unified-static-builds

Conversation

@mostlygeek
Copy link
Copy Markdown
Owner

No description provided.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 31, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 02f9b205-8608-4df6-8c6f-26d65daa92da

📥 Commits

Reviewing files that changed from the base of the PR and between 63e5246 and 5eca715.

📒 Files selected for processing (2)
  • docker/unified/Dockerfile
  • docker/unified/install-llama.sh
✅ Files skipped from review due to trivial changes (1)
  • docker/unified/install-llama.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • docker/unified/Dockerfile

Walkthrough

The pull request transitions the Docker build and runtime configuration from dynamically linked binaries with shared libraries to statically linked binaries. The build script disables shared library compilation via CMake flag, removes shared library installation infrastructure, and the Docker runtime stage copies only the final binaries.

Changes

Cohort / File(s) Summary
Static linking migration
docker/unified/Dockerfile, docker/unified/install-llama.sh
Disabled shared library compilation by adding -DBUILD_SHARED_LIBS=OFF to CMake build, removed /install/lib directory creation and .so* library copying, removed CUDA shared linker flags, updated Docker runtime to copy only llama-server and llama-cli binaries without libraries.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No description was provided by the author, making it impossible to assess relevance to the changeset. Add a pull request description explaining the rationale and benefits of switching to static library builds.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: converting the Docker build to use static libraries instead of shared libraries for llama.cpp.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docker-unified-static-builds

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Use BUILD_SHARED_LIBS=OFF so llama.cpp's internal libraries (libggml,
libllama) are statically linked into the binaries, eliminating the need
to copy and manage shared libraries in the runtime container.

- add -DBUILD_SHARED_LIBS=OFF to cmake flags
- remove shared library copy step and /install/lib directory
- remove CMAKE_SHARED_LINKER_FLAGS from CUDA build
- remove COPY --from=llama-build /install/lib/ from Dockerfile

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docker/unified/install-sd.sh (1)

23-30: ⚠️ Potential issue | 🟡 Minor

Add explicit -DBUILD_SHARED_LIBS=OFF flag for clarity and consistency with install-llama.sh.

install-llama.sh explicitly uses -DBUILD_SHARED_LIBS=OFF for static linking. While stable-diffusion.cpp defaults to static builds (SD_BUILD_SHARED_LIBS=OFF by default), adding the explicit flag here would improve consistency and make the intent clearer. Currently, line 65 copies .so files only if they exist, which is harmless but suggests shared library support; explicitly requesting static builds would eliminate any ambiguity.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docker/unified/install-sd.sh` around lines 23 - 30, The CMAKE_FLAGS array in
install-sd.sh should explicitly request static linking like install-llama.sh;
add the -DBUILD_SHARED_LIBS=OFF flag to the CMAKE_FLAGS tuple so cmake is
unambiguous about building static libs (update the CMAKE_FLAGS variable in
install-sd.sh where it is defined and used, alongside existing flags such as
-DSD_BUILD_EXAMPLES=ON), which prevents accidental shared .so output and
clarifies intent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docker/unified/Dockerfile`:
- Line 106: The runtime-vulkan stage uses an incompatible base image
"ubuntu:26.04"; update the Dockerfile's runtime-vulkan stage (the line "FROM
ubuntu:26.04 AS runtime-vulkan") to use the same supported base as the builder
stage (e.g., ubuntu:24.04 or the exact image used in the builder stage) so both
stages are consistent.

---

Outside diff comments:
In `@docker/unified/install-sd.sh`:
- Around line 23-30: The CMAKE_FLAGS array in install-sd.sh should explicitly
request static linking like install-llama.sh; add the -DBUILD_SHARED_LIBS=OFF
flag to the CMAKE_FLAGS tuple so cmake is unambiguous about building static libs
(update the CMAKE_FLAGS variable in install-sd.sh where it is defined and used,
alongside existing flags such as -DSD_BUILD_EXAMPLES=ON), which prevents
accidental shared .so output and clarifies intent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7e7332af-f8ec-4b99-a784-e57f30216bc5

📥 Commits

Reviewing files that changed from the base of the PR and between 1e44077 and 63e5246.

📒 Files selected for processing (4)
  • .github/workflows/unified-docker.yml
  • docker/unified/Dockerfile
  • docker/unified/install-llama.sh
  • docker/unified/install-sd.sh

@mostlygeek mostlygeek force-pushed the docker-unified-static-builds branch from 63e5246 to 5eca715 Compare March 31, 2026 13:14
@mostlygeek mostlygeek merged commit c2c8cfa into main Mar 31, 2026
4 checks passed
@mostlygeek mostlygeek deleted the docker-unified-static-builds branch March 31, 2026 19:38
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.

1 participant