[PR #5579] [MERGED] Statically link c++ and thread lib on windows #11834

Closed
opened 2026-04-12 23:40:12 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/5579
Author: @dhiltgen
Created: 7/9/2024
Status: Merged
Merged: 7/9/2024
Merged by: @dhiltgen

Base: mainHead: win_static_deps


📝 Commits (1)

  • b51e3b6 Statically link c++ and thread lib

📊 Changes

2 files changed (+2 additions, -7 deletions)

View changed files

📝 .github/workflows/release.yaml (+0 -5)
📝 llm/llm.go (+2 -2)

📄 Description

This makes sure we statically link the c++ and thread library on windows to avoid unnecessary runtime dependencies on non-standard DLLs

On my dev box, I have these libpthread.dll.a libraries and my local builds were leaking the dependency

e.g.:

> gci -path C:\msys64\ -r -fi 'libpthread.dll.a'

    Directory: C:\msys64\ucrt64\lib

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           4/27/2024 12:18 PM          94672 libpthread.dll.a

Before this change (my local builds):

> dumpbin /dependents ./ollama.exe
Microsoft (R) COFF/PE Dumper Version 14.40.33811.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file .\ollama.exe

File Type: EXECUTABLE IMAGE

  Image has the following dependencies:

    libstdc++-6.dll
    KERNEL32.dll
    msvcrt.dll
    libwinpthread-1.dll

After this change:

> dumpbin /dependents .\ollama.exe
Microsoft (R) COFF/PE Dumper Version 14.29.30154.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file .\ollama.exe

File Type: EXECUTABLE IMAGE

  Image has the following dependencies:

    KERNEL32.dll
    msvcrt.dll

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/5579 **Author:** [@dhiltgen](https://github.com/dhiltgen) **Created:** 7/9/2024 **Status:** ✅ Merged **Merged:** 7/9/2024 **Merged by:** [@dhiltgen](https://github.com/dhiltgen) **Base:** `main` ← **Head:** `win_static_deps` --- ### 📝 Commits (1) - [`b51e3b6`](https://github.com/ollama/ollama/commit/b51e3b63ac7bc995e99f3a8f7c1b507a1f8fb5d9) Statically link c++ and thread lib ### 📊 Changes **2 files changed** (+2 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/release.yaml` (+0 -5) 📝 `llm/llm.go` (+2 -2) </details> ### 📄 Description This makes sure we statically link the c++ and thread library on windows to avoid unnecessary runtime dependencies on non-standard DLLs On my dev box, I have these `libpthread.dll.a` libraries and my local builds were leaking the dependency e.g.: ``` > gci -path C:\msys64\ -r -fi 'libpthread.dll.a' Directory: C:\msys64\ucrt64\lib Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 4/27/2024 12:18 PM 94672 libpthread.dll.a ``` Before this change (my local builds): ``` > dumpbin /dependents ./ollama.exe Microsoft (R) COFF/PE Dumper Version 14.40.33811.0 Copyright (C) Microsoft Corporation. All rights reserved. Dump of file .\ollama.exe File Type: EXECUTABLE IMAGE Image has the following dependencies: libstdc++-6.dll KERNEL32.dll msvcrt.dll libwinpthread-1.dll ``` After this change: ``` > dumpbin /dependents .\ollama.exe Microsoft (R) COFF/PE Dumper Version 14.29.30154.0 Copyright (C) Microsoft Corporation. All rights reserved. Dump of file .\ollama.exe File Type: EXECUTABLE IMAGE Image has the following dependencies: KERNEL32.dll msvcrt.dll ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-12 23:40:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#11834