You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ 95%] Building CXX object tools/cli/CMakeFiles/llama-cli.dir/cli.cpp.o
In file included from /home/asbjorn/Development/llama-cpp-rs/llama-cpp-sys-2/llama.cpp/tools/cli/../server/server-task.h:12,
from /home/asbjorn/Development/llama-cpp-rs/llama-cpp-sys-2/llama.cpp/tools/cli/../server/server-context.h:2,
from /home/asbjorn/Development/llama-cpp-rs/llama-cpp-sys-2/llama.cpp/tools/cli/cli.cpp:6:
/home/asbjorn/Development/llama-cpp-rs/llama-cpp-sys-2/llama.cpp/tools/cli/../server/server-common.h:7:10: fatal error: mtmd.h: No such file or directory
7 | #include "mtmd.h"
| ^~~~~~~~
compilation terminated.
make[2]: *** [tools/cli/CMakeFiles/llama-cli.dir/build.make:76: tools/cli/CMakeFiles/llama-cli.dir/cli.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:4013: tools/cli/CMakeFiles/llama-cli.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
This build error is what has prevented utilityai/llama-cpp-rs from bumping the llama.cpp version for the past month.
The Fix
I fixed this by moving the if (LLAMA_BUILD_SERVER) conditional from tools/CMakeLists.txt into the part of tools/server/CMakeLists.txt that builds the actual server executable. So now if LLAMA_BUILD_SERVER is OFF, it will still build the server shared libs (which llama-cli depend on), but not the server executable itself.
I fixed this by moving the cli target into the LLAMA_BUILD_SERVER conditional.
If LLAMA_BUILD_TOOLS=ON and LLAMA_BUILD_SERVER=OFF, it will not build cli or server, but it will build the rest.
I have run the ci/run.sh testing suite to confirm that everything works as before.
AI Disclosure
The code changes in this PR were all made and verified by human hands and eyes, but LLM assistance was used for identifying the problem and suggesting several solutions (one of which is this solution).
You can skip building llama-cli when build_server is disabled. I prefer that simple fix. You won't use cli for binding anyway
We don't need llama-cli for bindings, but don't we need to have LLAMA_BUILD_TOOLS enabled in order to have multimodal support in the bindings? It seems like all of the mtmd stuff lives in tools/mtmd/.
I have tested setting LLAMA_BUILD_TOOLS=OFF in utilityai/llama-cpp-rs, and it indeed does result in a linking error. It was enabled in llama-cpp-rs when multimodal support was added in utilityai/llama-cpp-rs#790
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Problem
The problem is that building with
-DLLAMA_BUILD_SERVER=OFFdoes not work, sincellama-clinow depends onserver-context(since #17824).To reproduce the issue on current latest master (commit 5642667):
It will produce the following error:
This build error is what has prevented utilityai/llama-cpp-rs from bumping the llama.cpp version for the past month.
The Fix
I fixed this by moving theif (LLAMA_BUILD_SERVER)conditional fromtools/CMakeLists.txtinto the part oftools/server/CMakeLists.txtthat builds the actual server executable. So now ifLLAMA_BUILD_SERVERisOFF, it will still build the server shared libs (whichllama-clidepend on), but not the server executable itself.I fixed this by moving the
clitarget into theLLAMA_BUILD_SERVERconditional.If
LLAMA_BUILD_TOOLS=ONandLLAMA_BUILD_SERVER=OFF, it will not build cli or server, but it will build the rest.I have run the
ci/run.shtesting suite to confirm that everything works as before.AI Disclosure
The code changes in this PR were all made and verified by human hands and eyes, but LLM assistance was used for identifying the problem and suggesting several solutions (one of which is this solution).