Skip to content

common: json.h: fix clang lto - #27575

Merged
ngxson merged 1 commit into
masterfrom
xsn/common_json_lto
Aug 22, 2026
Merged

common: json.h: fix clang lto#27575
ngxson merged 1 commit into
masterfrom
xsn/common_json_lto

Conversation

@ngxson

@ngxson ngxson commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Overview

Ref discussion #27511

Requirements

@ngxson
ngxson requested a review from a team as a code owner August 22, 2026 21:44
@ngxson ngxson mentioned this pull request Aug 22, 2026
5 tasks
@ngxson
ngxson merged commit 70adb1b into master Aug 22, 2026
24 of 26 checks passed
@maddes8cht

maddes8cht commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

As requested in #27511 (comment) I've compiled this PR under windows.

Tested and confirmed working!

I encountered the LTO linking issue on Windows with clang-cl + -flto=thin, and this PR resolves it for me.

Test environment:

  • Windows 11
  • AMD Ryzen 5 3600X (6 cores, 12 threads)
  • NVIDIA RTX 3060 (12GB VRAM)
  • clang-cl (LLVM) with ThinLTO enabled
  • Static linking with vcpkg (x64-windows-static)

Build flags:

-DCMAKE_C_COMPILER=clang-cl
-DCMAKE_CXX_COMPILER=clang-cl
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
-DCMAKE_CXX_FLAGS="/EHsc /O2 /D_CRT_SECURE_NO_WARNINGS /wd4996 /D_AMD64_ -flto=thin"
-DCMAKE_C_FLAGS="/EHsc /O2 /D_CRT_SECURE_NO_WARNINGS /wd4996 /D_AMD64_ -flto=thin"
-DGGML_LTO=ON

Results:

  • Build completes successfully
  • binaries (tested llama.exe, llama-cli.exe, llama-server.exe) execute normally

Thank you for the fix!

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