ollama - ๐Ÿ’ก(How to fix) Fix Build failed on Loongarch64

Official PRs (โ€ฆ)
ON THIS PAGE

Recommended Tools

ร—6

Utilities matched from this issueโ€™s tags and category โ€” try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful ยท Quick feedback

Loadingโ€ฆ

Error Message

CMake Error at ml/backend/ggml/ggml/src/ggml-cpu/CMakeLists.txt:663 (target_sources): CMake Error at ml/backend/ggml/ggml/src/CMakeLists.txt:251 (add_library):

Code Example

430     elseif (GGML_SYSTEM_ARCH STREQUAL "loongarch64")
431         message(STATUS "loongarch64 detected")
432         list(APPEND GGML_CPU_SOURCES ggml-cpu/arch/loongarch/quants.c)
433 
434         list(APPEND ARCH_FLAGS -march=loongarch64)
435         if (GGML_LASX)
436             list(APPEND ARCH_FLAGS -mlasx)
437         endif()

---

-- Warning: ccache not found - consider installing it for faster compilation or disable this warning with GGML_CCACHE=OFF
-- CMAKE_SYSTEM_PROCESSOR: loongarch64
-- GGML_SYSTEM_ARCH: loongarch64
-- Including CPU backend
-- loongarch64 detected
-- Adding CPU backend variant ggml-cpu: -march=loongarch64 
-- Vulkan found
-- GL_KHR_cooperative_matrix supported by glslc
-- GL_NV_cooperative_matrix2 supported by glslc
-- GL_EXT_integer_dot_product supported by glslc
-- GL_EXT_bfloat16 supported by glslc
-- Configuring done (0.4s)
CMake Error at ml/backend/ggml/ggml/src/ggml-cpu/CMakeLists.txt:663 (target_sources):
  Cannot find source file:

    ggml-cpu/arch/loongarch/quants.c
Call Stack (most recent call first):
  ml/backend/ggml/ggml/src/CMakeLists.txt:428 (ggml_add_cpu_backend_variant_impl)


CMake Error at ml/backend/ggml/ggml/src/CMakeLists.txt:251 (add_library):
  No SOURCES given to target: ggml-cpu
Call Stack (most recent call first):
  ml/backend/ggml/ggml/src/ggml-cpu/CMakeLists.txt:22 (ggml_add_backend_library)
  ml/backend/ggml/ggml/src/CMakeLists.txt:428 (ggml_add_cpu_backend_variant_impl)
RAW_BUFFERClick to expand / collapse

What is the issue?

The build failed on Loongarch64 due to the missing file ggml-cpu/arch/loongarch/quants.c.

The following code references the file ggml/cpu/arch/loongarch/quants.c, but this file does not actually exist.

430     elseif (GGML_SYSTEM_ARCH STREQUAL "loongarch64")
431         message(STATUS "loongarch64 detected")
432         list(APPEND GGML_CPU_SOURCES ggml-cpu/arch/loongarch/quants.c)
433 
434         list(APPEND ARCH_FLAGS -march=loongarch64)
435         if (GGML_LASX)
436             list(APPEND ARCH_FLAGS -mlasx)
437         endif()

Relevant log output

-- Warning: ccache not found - consider installing it for faster compilation or disable this warning with GGML_CCACHE=OFF
-- CMAKE_SYSTEM_PROCESSOR: loongarch64
-- GGML_SYSTEM_ARCH: loongarch64
-- Including CPU backend
-- loongarch64 detected
-- Adding CPU backend variant ggml-cpu: -march=loongarch64 
-- Vulkan found
-- GL_KHR_cooperative_matrix supported by glslc
-- GL_NV_cooperative_matrix2 supported by glslc
-- GL_EXT_integer_dot_product supported by glslc
-- GL_EXT_bfloat16 supported by glslc
-- Configuring done (0.4s)
CMake Error at ml/backend/ggml/ggml/src/ggml-cpu/CMakeLists.txt:663 (target_sources):
  Cannot find source file:

    ggml-cpu/arch/loongarch/quants.c
Call Stack (most recent call first):
  ml/backend/ggml/ggml/src/CMakeLists.txt:428 (ggml_add_cpu_backend_variant_impl)


CMake Error at ml/backend/ggml/ggml/src/CMakeLists.txt:251 (add_library):
  No SOURCES given to target: ggml-cpu
Call Stack (most recent call first):
  ml/backend/ggml/ggml/src/ggml-cpu/CMakeLists.txt:22 (ggml_add_backend_library)
  ml/backend/ggml/ggml/src/CMakeLists.txt:428 (ggml_add_cpu_backend_variant_impl)

OS

No response

GPU

No response

CPU

No response

Ollama version

No response

Vote matrix ยท Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loadingโ€ฆ

Still need to ship something?

ร—6

Another batch ranked right after the header list โ€” different links, same matching logic.

Back to top recommendations

TRENDING

ollama - ๐Ÿ’ก(How to fix) Fix Build failed on Loongarch64