[GH-ISSUE #9117] ODR violations from llama.cpp/common/json.hpp #67989

Closed
opened 2026-05-04 12:12:57 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @srcshelton on GitHub (Feb 14, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/9117

What is the issue?

When building (currently) latest ollama from source with gcc-14.2, the build-system is reporting C++ One Definition Rule violations from the JSON-handling code in llama.cpp.

It's unclear to me whether this is more of a question of style or correctness, but the examples at https://en.wikipedia.org/wiki/One_Definition_Rule suggest that multiple definitions can lead to unanticipated results when code is executed...

Relevant log output

* QA Notice: Package triggers severe warnings which indicate that it may exhibit random runtime failures.
 * ollama-0.5.11/llama/llama.cpp/common/json.hpp:19726:11: warning: type 'union json_value' violates the C++ One Definition Rule [-Wodr]
 * ollama-0.5.11/llama/llama.cpp/common/json.hpp:23492:12: warning: type 'struct data' violates the C++ One Definition Rule [-Wodr]
 * ollama-0.5.11/llama/llama.cpp/common/json.hpp:19400:7: warning: type 'struct basic_json' violates the C++ One Definition Rule [-Wodr]
 * ollama-0.5.11/llama/llama.cpp/common/json-schema-to-grammar.h:8:13: warning: 'json_schema_to_grammar' violates the C++ One Definition Rule [-Wodr]

OS

Linux

GPU

No response

CPU

Intel

Ollama version

0.5.11

Originally created by @srcshelton on GitHub (Feb 14, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/9117 ### What is the issue? When building (currently) latest ollama from source with gcc-14.2, the build-system is reporting C++ One Definition Rule violations from the JSON-handling code in `llama.cpp`. It's unclear to me whether this is more of a question of style or correctness, but the examples at https://en.wikipedia.org/wiki/One_Definition_Rule suggest that multiple definitions can lead to unanticipated results when code is executed... ### Relevant log output ```shell * QA Notice: Package triggers severe warnings which indicate that it may exhibit random runtime failures. * ollama-0.5.11/llama/llama.cpp/common/json.hpp:19726:11: warning: type 'union json_value' violates the C++ One Definition Rule [-Wodr] * ollama-0.5.11/llama/llama.cpp/common/json.hpp:23492:12: warning: type 'struct data' violates the C++ One Definition Rule [-Wodr] * ollama-0.5.11/llama/llama.cpp/common/json.hpp:19400:7: warning: type 'struct basic_json' violates the C++ One Definition Rule [-Wodr] * ollama-0.5.11/llama/llama.cpp/common/json-schema-to-grammar.h:8:13: warning: 'json_schema_to_grammar' violates the C++ One Definition Rule [-Wodr] ``` ### OS Linux ### GPU _No response_ ### CPU Intel ### Ollama version 0.5.11
GiteaMirror added the bug label 2026-05-04 12:12:57 -05:00
Author
Owner

@srcshelton commented on GitHub (Feb 14, 2025):

Update: This looks like https://github.com/nlohmann/json/issues/4116 upstream?

<!-- gh-comment-id:2660083636 --> @srcshelton commented on GitHub (Feb 14, 2025): Update: This looks like https://github.com/nlohmann/json/issues/4116 upstream?
Author
Owner

@rick-github commented on GitHub (Feb 14, 2025):

Probably an issue for the source repo, llama.cpp.

<!-- gh-comment-id:2660091091 --> @rick-github commented on GitHub (Feb 14, 2025): Probably an issue for the source repo, [llama.cpp](https://github.com/ggerganov/llama.cpp/issues).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#67989