Make llama.cpp CURL dependency optional when building from source#3822
Conversation
Summary of ChangesHello @Fizza-Mukhtar, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the build process for Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request aims to make the llama.cpp CURL dependency optional, which is a great improvement for build robustness. The overall approach is correct, but there are two critical issues in the implementation where f-string formatting is missing for command strings. This will cause the build to fail because the CURL_FLAG variable is not interpolated. I've added comments with suggestions to fix these bugs. With these fixes, the PR should be good to merge.
| # Instead use CMAKE | ||
| commands = [ | ||
| "cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=OFF -DLLAMA_CURL=ON", | ||
| "cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=OFF {CURL_FLAG}", |
There was a problem hiding this comment.
This string should be an f-string to correctly interpolate the CURL_FLAG variable. As it is, the literal string {CURL_FLAG} will be passed to the cmake command, which will cause a build failure.
| "cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=OFF {CURL_FLAG}", | |
| f"cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=OFF {CURL_FLAG}", |
| # Instead use CMAKE | ||
| commands = [ | ||
| "cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=OFF -DLLAMA_CURL=ON", | ||
| "cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=OFF {CURL_FLAG}", |
There was a problem hiding this comment.
Similar to a previous part of the code, this string needs to be an f-string to interpolate the CURL_FLAG variable. Without the f prefix, the command will receive the literal string {CURL_FLAG}, causing the build to fail.
| "cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=OFF {CURL_FLAG}", | |
| f"cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=OFF {CURL_FLAG}", |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| # Instead use CMAKE | ||
| commands = [ | ||
| "cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=OFF -DLLAMA_CURL=ON", | ||
| "cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=OFF {CURL_FLAG}", |
There was a problem hiding this comment.
Format CURL_FLAG before passing to cmake
When the make build fails and try_execute falls back to CMake, this command passes the literal string {CURL_FLAG} to cmake because it isn’t an f-string. That means CMake receives an unrecognized argument instead of -DLLAMA_CURL=ON/OFF, so the fallback build can fail regardless of curl availability. This regression only shows up in the CMake fallback path.
Useful? React with 👍 / 👎.
| # Instead use CMAKE | ||
| commands = [ | ||
| "cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=OFF -DLLAMA_CURL=ON", | ||
| "cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=OFF {CURL_FLAG}", |
There was a problem hiding this comment.
Format CURL_FLAG before passing to cmake
In the blocking install path’s CMake fallback, {CURL_FLAG} is not interpolated (string is missing the f prefix). As a result, the literal placeholder is passed to CMake and the fallback build can fail even when it’s supposed to disable curl. This only affects environments where the make build fails and the CMake path is used.
Useful? React with 👍 / 👎.
96de01d to
43fb35e
Compare
for more information, see https://pre-commit.ci
|
Thanks this works! |
…curl Make llama.cpp CURL dependency optional when building from source
Fixes build failures when libcurl is unavailable by conditionally
disabling -DLLAMA_CURL during llama.cpp CMake builds. This matches
upstream CMake guidance and prevents crashes in Docker / minimal
Linux environments while preserving CURL support when available.
Fixes #3453