Compile bug: tools/server/server-context.cpp fails to compile with Intel icx/icpx: std::setw missing <iomanip> include

Open Beginner friendly
#31,458 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@afnan-mojumder is already working on this.

Since Nov 1, 2026.

  • #31515 by @afnan-mojumder — open

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
90/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp
Domain
backend

Research direction

The fix is in tools/server/server-context.cpp where std::setw is used at lines 4234 and 4241. Add #include <iomanip> near the top with other STL includes. Done means the file compiles with icx/icpx without the setw error.

Written by the indexing model from the issue text.

Description

bug-unconfirmed
Git commit

$ git rev-parse HEAD
8956c769e8ababd9fbd89c81764f241d5f515d68

Operating systems

Linux

GGML backends

CPU

Problem description & steps to reproduce

When building current main with the Intel oneAPI DPC++/C++ Compiler (icx/icpx), compilation of tools/server/server-context.cpp fails because std::setw is used without including .
GCC/libstdc++ accidentally transitively includes through other headers, so this compiles there, but icx/libc++-style strict include checking correctly rejects it. This is a "missing explicit include" regression.

Environment
Branch: main (latest)
Compiler: Intel oneAPI icx / icpx (latest)
CMake flags: -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=Intel10_64lp (also reproduces with a minimal build)
OS: Rocky 8.9

Reproduction
cmake -B build -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx
cmake --build build -j

Error
tools/server/server-context.cpp:4234:57: error: no member named 'setw' in namespace 'std'
st0 << std::setw(8) << token;
^~~~
tools/server/server-context.cpp:4241:57: error: no member named 'setw' in namespace 'std'
st1 << std::setw(8) << token;
^~~~

Root cause
std::setw is declared in (C++ standard). tools/server/server-context.cpp uses it but does not include that header, relying on transitive inclusion from other STL headers, which is not guaranteed.

Suggested fix
Add the missing include near the other STL includes in tools/server/server-context.cpp:
#include

First Bad Commit

No response

Compile command
cmake -B build  -DCMAKE_BUILD_TYPE=RelWithDebInfo   -DCMAKE_C_COMPILER="$ICX"   -DCMAKE_CXX_COMPILER="$ICPX"   -DGGML_NATIVE=ON   -DCMAKE_CXX_STANDARD=17   -DCMAKE_CXX_STANDARD_LIBRARIES="${FS}"   -DCMAKE_MODULE_LINKER_FLAGS="${RPATH} ${FS}"   -DCMAKE_SHARED_LINKER_FLAGS="${RPATH} ${FS}"   -DCMAKE_EXE_LINKER_FLAGS="${RPATH} ${FS} -Wl,--no-as-needed"   -DGGML_AVX=ON -DGGML_AVX2=ON -DGGML_FMA=ON -DGGML_F16C=ON   -DGGML_AVX512=ON -DGGML_AVX512_VBMI=ON -DGGML_AVX512_VNNI=ON -DGGML_AVX512_BF16=ON   -DGGML_BLAS=ON   -DGGML_BLAS_VENDOR=Intel10_64lp   -DGGML_LLAMAFILE=OFF   -DLLAMA_BUILD_TESTS=OFF   -DLLAMA_BUILD_EXAMPLES=ON   -DLLAMA_BUILD_CLI=OFF   -DLLAMA_BUILD_BENCH=OFF   -DLLAMA_BUILD_SERVER=ON
Relevant log output
Error
tools/server/server-context.cpp:4234:57: error: no member named 'setw' in namespace 'std'
    st0 << std::setw(8) << token;
                        ^~~~
tools/server/server-context.cpp:4241:57: error: no member named 'setw' in namespace 'std'
    st1 << std::setw(8) << token;
                        ^~~~
Dominant language
C++
Stars
133k
Forks
25.1k
Avg merge
2d 7h
Merged PRs (30d)
504

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ggml-org/llama.cpp

All issues in ggml-org/llama.cpp

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.