Skip to content

Fix msys2 build error and warnings#1009

Merged
prusnak merged 1 commit intoggml-org:masterfrom
na-na-hi:mf
Apr 16, 2023
Merged

Fix msys2 build error and warnings#1009
prusnak merged 1 commit intoggml-org:masterfrom
na-na-hi:mf

Conversation

@na-na-hi
Copy link
Copy Markdown
Contributor

Currently, main fails to build on mingw (msys2) due to missing headers:

llama.cpp: In function 'llama_context* llama_init_from_file(const char*, llama_context_params)':
llama.cpp:1675:23: error: 'time' was not declared in this scope; did you mean 'ftime'?
 1675 |         params.seed = time(NULL);
      |                       ^~~~
      |                       ftime

This is solved by including <ctime>.

Also there are several warnings about printf formats:

llama.cpp: In function 'size_t checked_div(size_t, size_t)':
llama.cpp:258:39: warning: unknown conversion type character 'z' in format [-Wformat=]
  258 |         throw format("error dividing %zu / %zu", a, b);
      |                                       ^

As far as I know, this wraning is bogus and appears to be a bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95130
This is solved by using gnu_printf for format attribute when building for mingw.

@prusnak prusnak merged commit 2d3481c into ggml-org:master Apr 16, 2023
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
phuongncn pushed a commit to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4 that referenced this pull request Apr 28, 2026
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.

2 participants