Switch windows to clang (#7407)
* Switch over to clang for deepseek on windows The patch for deepseek requires clang on windows. gcc on windows has a buggy c++ library and can't handle the unicode characters * Fail fast with wrong compiler on windows Avoid users mistakenly building with GCC when we need clang
This commit is contained in:
parent
078f666f73
commit
c9ca386131
2 changed files with 10 additions and 3 deletions
|
@ -296,10 +296,13 @@ The following tools are required as a minimal development environment to build C
|
||||||
- https://go.dev/dl/
|
- https://go.dev/dl/
|
||||||
- Git
|
- Git
|
||||||
- https://git-scm.com/download/win
|
- https://git-scm.com/download/win
|
||||||
- GCC and Make. There are multiple options on how to go about installing these tools on Windows. We have verified the following, but others may work as well:
|
- clang with gcc compat and Make. There are multiple options on how to go about installing these tools on Windows. We have verified the following, but others may work as well:
|
||||||
- [MSYS2](https://www.msys2.org/)
|
- [MSYS2](https://www.msys2.org/)
|
||||||
- After installing, from an MSYS2 terminal, run `pacman -S mingw-w64-ucrt-x86_64-gcc make` to install the required tools
|
- After installing, from an MSYS2 terminal, run `pacman -S mingw-w64-clang-x86_64-gcc-compat mingw-w64-clang-x86_64-clang make` to install the required tools
|
||||||
- Assuming you used the default install prefix for msys2 above, add `c:\msys64\ucrt64\bin` and `c:\msys64\usr\bin` to your environment variable `PATH` where you will perform the build steps below (e.g. system-wide, account-level, powershell, cmd, etc.)
|
- Assuming you used the default install prefix for msys2 above, add `C:\msys64\clang64\bin` and `c:\msys64\usr\bin` to your environment variable `PATH` where you will perform the build steps below (e.g. system-wide, account-level, powershell, cmd, etc.)
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> Due to bugs in the GCC C++ library for unicode support, Ollama requires clang on windows. If the gcc executable in your path is not the clang compatibility wrapper, the build will error.
|
||||||
|
|
||||||
Then, build the `ollama` binary:
|
Then, build the `ollama` binary:
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,10 @@ ifeq ($(OS),windows)
|
||||||
EXE_EXT := .exe
|
EXE_EXT := .exe
|
||||||
SHARED_PREFIX :=
|
SHARED_PREFIX :=
|
||||||
CPU_FLAG_PREFIX := /arch:
|
CPU_FLAG_PREFIX := /arch:
|
||||||
|
_GCC_TEST:=$(findstring clang,$(shell gcc --version))
|
||||||
|
ifneq ($(_GCC_TEST),clang)
|
||||||
|
$(error WRONG COMPILER DETECTED $(shell type gcc) - gcc must be a clang compat compiler on windows - see docs/development.md for setup instructions)
|
||||||
|
endif
|
||||||
ifneq ($(HIP_PATH),)
|
ifneq ($(HIP_PATH),)
|
||||||
# If HIP_PATH has spaces, hipcc trips over them when subprocessing
|
# If HIP_PATH has spaces, hipcc trips over them when subprocessing
|
||||||
HIP_PATH := $(shell cygpath -m -s "$(patsubst %\,%,$(HIP_PATH))")
|
HIP_PATH := $(shell cygpath -m -s "$(patsubst %\,%,$(HIP_PATH))")
|
||||||
|
|
Loading…
Reference in a new issue