llama.cpp icon indicating copy to clipboard operation
llama.cpp copied to clipboard

Compile bug: Llama-server isn't built due to missing public/bundle.css and public/bundle.js

Open karambaso opened this issue 6 months ago • 12 comments

Git commit

b9165

Operating systems

Linux

GGML backends

CPU

Problem description & steps to reproduce

When compiling the b9165 from sources the server compilation fails with missing files errors.

First Bad Commit

No response

Compile command

cmake -B build -DGIT_EXE="" -DLLAMA_CURL=OFF
cmake --build build --config Release -j 24

Relevant log output

[ 98%] Generating bundle.css.hpp
[ 98%] Generating bundle.js.hpp
[ 98%] Generating loading.html.hpp
[ 99%] Generating index.html.hpp
CMake Error at llama.cpp-b9165/scripts/xxd.cmake:10 (file):
  file failed to open for reading (No such file or directory):

    llama.cpp-b9165/tools/server/public/bundle.css


CMake Error at llama.cpp-b9165/scripts/xxd.cmake:10 (file):
  file failed to open for reading (No such file or directory):

    llama.cpp-b9165/tools/server/public/bundle.js


gmake[2]: *** [tools/server/CMakeFiles/llama-server.dir/build.make:78: tools/server/bundle.js.hpp] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[2]: *** [tools/server/CMakeFiles/llama-server.dir/build.make:82: tools/server/bundle.css.hpp] Error 1
CMake Error at llama.cpp-b9165/scripts/xxd.cmake:10 (file):
  file failed to open for reading (No such file or directory):

    llama.cpp-b9165/tools/server/public/loading.html


CMake Error at llama.cpp-b9165/scripts/xxd.cmake:13 (string):
  string sub-command LENGTH requires two arguments.


gmake[2]: *** [tools/server/CMakeFiles/llama-server.dir/build.make:86: tools/server/loading.html.hpp] Error 1
gmake[2]: *** [tools/server/CMakeFiles/llama-server.dir/build.make:74: tools/server/index.html.hpp] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:5668: tools/server/CMakeFiles/llama-server.dir/all] Error 2

karambaso avatar May 15 '26 15:05 karambaso

Seems this was introduced in a merge yesterday in 253ba110b.

After that one needs npm to build the bundle, or huggingface to fetch it.

zoitrok avatar May 15 '26 17:05 zoitrok

Can you follow the documentation in https://github.com/ggml-org/llama.cpp/pull/22937 and try again?

taronaeo avatar May 16 '26 15:05 taronaeo

Can you follow the documentation in #22937 and try again?

The only option the page you have referred provides is to completely disable web ui. Of course, web developers perceive the internet connection as something absolutely pervasive, but there are many cases when build machine is offline. For such cases, obviously, a downloadable bundle should be present somewhere, better in the build archive that is downloadable from this site. But there is no such bundle. And no instructions how to build the server in the docs/build.md. Another common practice is to issue a warning about missing internet connection and it's implications - refusal of accessing llama.cpp using web server. There's nothing like that. Then it seems the update that moved essential for build process parts of the source archive somewhere else is made more harm than added any positive value. At least for those who have to build offline.

karambaso avatar May 17 '26 09:05 karambaso

The only option the page you have referred provides is to completely disable web ui.

I don't know how far you have read the PR but its clearly documented in the "Build cases" CMake options table. I've built it locally without any issues as shown here:

taronaeo@taronaeo:/opt/llama.cpp$ cmake -S . -Bbuild -GNinja -DLLAMA_BUILD_WEBUI=ON -DLLAMA_USE_PREBUILT_WEBUI=ON

taronaeo@taronaeo:/opt/llama.cpp$ cmake --build build --config Release -j$(nproc)
[215/507] Building/provisioning UI assets (npm build -> HF Bucket fallback)
-- UI: npm not found, skipping npm build and trying HF Bucket download
-- UI: downloading assets from version: https://huggingface.co/buckets/ggml-org/llama-ui/resolve/b9198
-- UI: failed to download index.html from version: "HTTP response code said error"
-- UI: downloading assets from latest: https://huggingface.co/buckets/ggml-org/llama-ui/resolve/latest
-- UI: downloaded index.html
-- UI: downloaded bundle.js
-- UI: downloaded bundle.css
-- UI: downloaded loading.html
-- UI: verifying checksums...
-- UI: all checksums verified
-- UI: provisioning complete
[507/507] Linking CXX executable bin/test-backend-ops

Try adding -DLLAMA_BUILD_WEBUI=ON -DLLAMA_USE_PREBUILT_WEBUI=ON build macros into your build step.

taronaeo avatar May 17 '26 11:05 taronaeo

confirming compiling is not working offline -DLLAMA_BUILD_WEBUI=ON/OFF -DLLAMA_USE_PREBUILT_WEBUI=ON/OFF flags are ignored in all combinations ,after 'make' command always want to download data from hf servers

jelspace avatar May 17 '26 16:05 jelspace

I've built it locally without any issues as shown here:

With the options "-DLLAMA_BUILD_WEBUI=ON -DLLAMA_USE_PREBUILT_WEBUI=ON" the build fails pointing to the same missing files. With the options "-DLLAMA_BUILD_WEBUI=OFF" http://localhost:8080 returns response code 404.

I suppose your case was not clean. Possibly there were some locally copied files that aren't present in the standard source distribution.

karambaso avatar May 17 '26 17:05 karambaso

Once again, I cannot reproduce your problem. Attached is a copy of my logs from start (git clone) to finish (launching the server) with a clean working copy. What version are you on? b9165 is very far apart from the latest b9209.

logs.cleaned.txt

Image

taronaeo avatar May 18 '26 09:05 taronaeo

I cannot reproduce your problem

Tested on the latest: b9209. Without the -DLLAMA_BUILD_WEBUI=ON it fails almost immediately. With -DLLAMA_BUILD_WEBUI=OFF it provides no web access to the LLM inference. Both ways are very bad for offline users.

I don't know how to underline in more details the importance of being offline and to work with clean download from this URL [https://github.com/ggml-org/llama.cpp/archive/refs/tags/b9209.zip], for example, for the build to fail. Having installed web developer tools also can affect the process. Maybe you should consult web developers about how to emulate an offline environment clearly.

karambaso avatar May 18 '26 14:05 karambaso

Maybe you should consult web developers about how to emulate an offline environment clearly.

I don't see where in the issue description was it stated that the problem occurs in an offline environment. Nevertheless, cc'ing @allozaur for reproduction and/or comments if any.

I won't be of further help as I can't reproduce this on my end.

taronaeo avatar May 18 '26 14:05 taronaeo

Hey, I will look into this

allozaur avatar May 18 '26 16:05 allozaur

Here is a reproducer on Linux to simulate an offline environment:

unshare -Un bash -c 'cmake -B build && cmake --build build -t llama-server -j 8'

I don't know how to simulate this on Mac.

Looking at most of these build issues, they're all related to being disconnected, either because of the user's environment or the underlying package system. For example, Nix and Gentoo block network access and only allow downloading sources that are validated by a checksum.

I think there are two things we can do to improve the situation:

  1. Graceful fallback to LLAMA_BUILD_UI=OFF with a warning, to still allow for a successful build. Users will complain, but this is analogous to the Make generator step finding dependencies and turning features on/off accordingly.
  2. For releases (b[0-9]+), provide an archive of the WebUI artifacts. This way users can pull the exact UI build artifacts in their packaging definitions.

@allozaur, thoughts?

aldehir avatar May 18 '26 17:05 aldehir

Here is a reproducer on Linux to simulate an offline environment:

unshare -Un bash -c 'cmake -B build && cmake --build build -t llama-server -j 8'

I don't know how to simulate this on Mac.

Looking at most of these build issues, they're all related to being disconnected, either because of the user's environment or the underlying package system. For example, Nix and Gentoo block network access and only allow downloading sources that are validated by a checksum.

I think there are two things we can do to improve the situation:

  1. Graceful fallback to LLAMA_BUILD_UI=OFF with a warning, to still allow for a successful build. Users will complain, but this is analogous to the Make generator step finding dependencies and turning features on/off accordingly.
  2. For releases (b[0-9]+), provide an archive of the WebUI artifacts. This way users can pull the exact UI build artifacts in their packaging definitions.

@allozaur, thoughts?

Well, I guess this is the best way to go for now.

allozaur avatar May 18 '26 19:05 allozaur

I can second this issue. I use RPC so keeping the systems offline is for security's sake.

I can agree that the combination of "-DLLAMA_BUILD_UI=OFF -DLLAMA_BUILD_WEBUI=OFF -DLLAMA_BUILD_UI=OFF" do resolve the build issue on the offline machine. While the UI was good to run quick tests API was the main concern.

alientony avatar May 19 '26 22:05 alientony

I confirm the issue, while updating the Guix package. Package build happens fully offline, for reproducibility and security reasons, and "-DLLAMA_BUILD_WEBUI=OFF -DLLAMA_BUILD_UI=OFF" becomes mandatory.

csantosb avatar May 21 '26 14:05 csantosb

please also check #23352

allozaur avatar May 21 '26 17:05 allozaur

note that the required files could be downloaded on a separate machine and copied to the offline build server: https://github.com/ggml-org/llama.cpp/issues/23156#issuecomment-4469635754

vbooka1 avatar May 23 '26 06:05 vbooka1

note that the required files could be downloaded on a separate machine and copied to the offline build server: #23156 (comment)

This is not a solution for downstream packages

csantosb avatar May 23 '26 10:05 csantosb

The UI is now built in CI. Instead of storing the build output in the git repo, the llama-server build now does one of the following:

  1. Use the existing tools/ui/dist output if present
  2. Build via npm
  3. Download prebuilt assets from the HF (Hugging Face) bucket

Options 2 and 3 require internet access. If that's not available, you can use the pre-built UI from releases: https://github.com/ggml-org/llama.cpp/releases

aldehir avatar May 25 '26 03:05 aldehir

Let's close the issue and reopen if anything else pops up

allozaur avatar May 25 '26 11:05 allozaur