[GH-ISSUE #12067] Ollama build fails for Power Architecture #54528

Closed
opened 2026-04-29 06:15:28 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @shalinib-ibm on GitHub (Aug 25, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/12067

What is the issue?

cmake -B build fails only for power architecture:

Relevant log output

cmake -B build 
fails with below error only for power architecture:

CMake Error at ml/backend/ggml/ggml/src/ggml-cpu/CMakeLists.txt:588 (target_sources): Cannot find source file: ggml-cpu/arch/powerpc/quants.c Call Stack (most recent call first): ml/backend/ggml/ggml/src/CMakeLists.txt:306 (ggml_add_cpu_backend_variant_impl) ml/backend/ggml/ggml/src/CMakeLists.txt:355 (ggml_add_cpu_backend_variant) CMake Error at ml/backend/ggml/ggml/src/ggml-cpu/CMakeLists.txt:7 (add_library): Cannot find source file: ggml-cpu/arch/powerpc/cpu-feats.cpp Call Stack (most recent call first): ml/backend/ggml/ggml/src/ggml-cpu/CMakeLists.txt:413 (ggml_add_cpu_backend_features) ml/backend/ggml/ggml/src/CMakeLists.txt:306 (ggml_add_cpu_backend_variant_impl) ml/backend/ggml/ggml/src/CMakeLists.txt:355 (ggml_add_cpu_backend_variant)

OS

Linux

GPU

No response

CPU

Other

Ollama version

No response

Originally created by @shalinib-ibm on GitHub (Aug 25, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/12067 ### What is the issue? cmake -B build fails only for power architecture: ### Relevant log output ```shell cmake -B build fails with below error only for power architecture: CMake Error at ml/backend/ggml/ggml/src/ggml-cpu/CMakeLists.txt:588 (target_sources): Cannot find source file: ggml-cpu/arch/powerpc/quants.c Call Stack (most recent call first): ml/backend/ggml/ggml/src/CMakeLists.txt:306 (ggml_add_cpu_backend_variant_impl) ml/backend/ggml/ggml/src/CMakeLists.txt:355 (ggml_add_cpu_backend_variant) CMake Error at ml/backend/ggml/ggml/src/ggml-cpu/CMakeLists.txt:7 (add_library): Cannot find source file: ggml-cpu/arch/powerpc/cpu-feats.cpp Call Stack (most recent call first): ml/backend/ggml/ggml/src/ggml-cpu/CMakeLists.txt:413 (ggml_add_cpu_backend_features) ml/backend/ggml/ggml/src/CMakeLists.txt:306 (ggml_add_cpu_backend_variant_impl) ml/backend/ggml/ggml/src/CMakeLists.txt:355 (ggml_add_cpu_backend_variant) ``` ### OS Linux ### GPU _No response_ ### CPU Other ### Ollama version _No response_
GiteaMirror added the bug label 2026-04-29 06:15:28 -05:00
Author
Owner

@shalinib-ibm commented on GitHub (Aug 25, 2025):

Below is the commit after build fails for power:
commit 1a19df1f3a Author: Michael Yang mxyng@pm.me Date: Thu Aug 14 14:42:58 2025 -0700

fix: Fix support for arch-specific ggml-cpu source files with new arrangement In https://github.com/ggml-org/llama.cpp/pull/13892, all arch-specific implementations were split out into a nested tree structure under ggml-cpu/arch.
This conflicts with standard CGO layout where all arch-specific source files are expected to live in the same directory as the parent go module and use suffixes based on GOOS and GOARCH. As such, there were really two options for getting this to work:

  1. Add a patch on top of the GGML sync to rearrange the files to match the GO layout convention
  2. Use CGO directives to conditionally include the nested source files in the compilation units This commit does (2) in order to minimize the set of changes needed on top of the upstream file layout.
    To get this to work, there are two key things needed: 1. In cpu.go, #cgo directives are added to explicitly set ${GOARCH} in the preprocessor directives 2. In arch-impls.c|cpp, use an #ifdef | #elif defined | #endif chain to explicitly include the .c|.cpp files for the given architecture from the nested directory
    With this change, under ml/backend/ggml/ggml/src/ggml-cpu/arch .. there is no folder for powerpc. So, cmake fails with missing file error
<!-- gh-comment-id:3219216379 --> @shalinib-ibm commented on GitHub (Aug 25, 2025): Below is the commit after build fails for power: commit 1a19df1f3a39481dfe686c8f1041f91531a04ada Author: Michael Yang <mxyng@pm.me> Date: Thu Aug 14 14:42:58 2025 -0700 fix: Fix support for arch-specific ggml-cpu source files with new arrangement In https://github.com/ggml-org/llama.cpp/pull/13892, all arch-specific implementations were split out into a nested tree structure under ggml-cpu/arch. This conflicts with standard CGO layout where all arch-specific source files are expected to live in the same directory as the parent go module and use suffixes based on GOOS and GOARCH. As such, there were really two options for getting this to work: 1. Add a patch on top of the GGML sync to rearrange the files to match the GO layout convention 2. Use CGO directives to conditionally include the nested source files in the compilation units This commit does (2) in order to minimize the set of changes needed on top of the upstream file layout. To get this to work, there are two key things needed: 1. In cpu.go, #cgo directives are added to explicitly set _${GOARCH}_ in the preprocessor directives 2. In arch-impls.c|cpp, use an #ifdef | #elif defined | #endif chain to explicitly include the .c|.cpp files for the given architecture from the nested directory With this change, under ml/backend/ggml/ggml/src/ggml-cpu/arch .. there is no folder for powerpc. So, cmake fails with missing file error
Author
Owner

@mchiang0610 commented on GitHub (Aug 25, 2025):

Thank you @shalinib-ibm, we don't currently have support for PowerPC architecture yet. The reason is because we would need to properly maintain this support, and have a plan in place.

<!-- gh-comment-id:3221974128 --> @mchiang0610 commented on GitHub (Aug 25, 2025): Thank you @shalinib-ibm, we don't currently have support for PowerPC architecture yet. The reason is because we would need to properly maintain this support, and have a plan in place.
Author
Owner

@shalinib-ibm commented on GitHub (Aug 26, 2025):

@mchiang0610 Thank you @mchiang0610 for providing the reason. I have a fix for this issue at this PR : [https://github.com/ollama/ollama/pull/12070], can you please review ?

<!-- gh-comment-id:3222563557 --> @shalinib-ibm commented on GitHub (Aug 26, 2025): @mchiang0610 Thank you @mchiang0610 for providing the reason. I have a fix for this issue at this PR : [https://github.com/ollama/ollama/pull/12070], can you please review ?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#54528