[GH-ISSUE #4552] Please support LoongArch ISA #64890

Open
opened 2026-05-03 19:10:57 -05:00 by GiteaMirror · 8 comments
Owner

Originally created by @HougeLangley on GitHub (May 21, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/4552

https://github.com/ggerganov/llama.cpp/pull/6454#issuecomment-2119832472

Originally created by @HougeLangley on GitHub (May 21, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/4552 https://github.com/ggerganov/llama.cpp/pull/6454#issuecomment-2119832472
GiteaMirror added the feature request label 2026-05-03 19:10:57 -05:00
Author
Owner

@HougeLangley commented on GitHub (May 28, 2024):

Dear friends,

I have re-downloaded the latest version of Ollama's Git code and created an Ollama library specifically for Loongarch64 ISA. Currently, I have modified two files: 'llm/generate/gen_common.sh' and 'llm/generate/gen_linux.sh', adding support for the LoongArch64 architecture and updating the Git version referenced in 'llm/llama.cpp' to accommodate the LASX and LSX extension instruction sets. ( https://github.com/ggerganov/llama.cpp/pull/6454 ) Additionally, I have also added support for the Loongarch64 architecture in 'llm/llm.go'.

https://github.com/HougeLangley/ollama-loongarch64/blob/master/llm/generate/gen_common.sh

https://github.com/HougeLangley/ollama-loongarch64/blob/master/llm/generate/gen_linux.sh

https://github.com/HougeLangley/ollama-loongarch64/blob/master/llm/llm.go

The current issue is that building Ollama with "go generate ./..." works fine, but during the execution of "go build .", it gives an error stating github.com/chewxy/math32 does not support LoongArch64. I previously mentioned this on the forum. After using 'go get -u github.com/chewxy/nmath32@7caa3bb', the issue is resolved.

https://github.com/chewxy/math32/issues/23#issuecomment-2105952080

But Ollama still fails to build successfully. Any assistance from fellow developers working with Loongarch64 in Gentoo would be greatly appreciated.

<!-- gh-comment-id:2135780676 --> @HougeLangley commented on GitHub (May 28, 2024): Dear friends, I have re-downloaded the latest version of Ollama's Git code and created an Ollama library specifically for Loongarch64 ISA. Currently, I have modified two files: '`llm/generate/gen_common.sh`' and '`llm/generate/gen_linux.sh`', adding support for the LoongArch64 architecture and updating the Git version referenced in '`llm/llama.cpp`' to accommodate the `LASX` and `LSX` extension instruction sets. ( https://github.com/ggerganov/llama.cpp/pull/6454 ) Additionally, I have also added support for the Loongarch64 architecture in '`llm/llm.go`'. https://github.com/HougeLangley/ollama-loongarch64/blob/master/llm/generate/gen_common.sh https://github.com/HougeLangley/ollama-loongarch64/blob/master/llm/generate/gen_linux.sh https://github.com/HougeLangley/ollama-loongarch64/blob/master/llm/llm.go The current issue is that building Ollama with "`go generate ./...`" works fine, but during the execution of "`go build .`", it gives an error stating github.com/chewxy/math32 does not support LoongArch64. I previously mentioned this on the forum. After using '`go get -u github.com/chewxy/nmath32@7caa3bb`', the issue is resolved. https://github.com/chewxy/math32/issues/23#issuecomment-2105952080 But Ollama still fails to build successfully. Any assistance from fellow developers working with Loongarch64 in Gentoo would be greatly appreciated.
Author
Owner

@HougeLangley commented on GitHub (May 28, 2024):

@xen0n

<!-- gh-comment-id:2135783151 --> @HougeLangley commented on GitHub (May 28, 2024): @xen0n
Author
Owner

@HougeLangley commented on GitHub (May 28, 2024):

My Ollama library For Testing https://github.com/HougeLangley/ollama-loongarch64

<!-- gh-comment-id:2135785025 --> @HougeLangley commented on GitHub (May 28, 2024): My Ollama library For Testing https://github.com/HougeLangley/ollama-loongarch64
Author
Owner

@HougeLangley commented on GitHub (May 28, 2024):

Additionally, I made modifications to the 'llm/patches' patch so that it can function properly.

https://github.com/HougeLangley/ollama-loongarch64/tree/master/llm/patches

<!-- gh-comment-id:2135799746 --> @HougeLangley commented on GitHub (May 28, 2024): Additionally, I made modifications to the '`llm/patches`' patch so that it can function properly. https://github.com/HougeLangley/ollama-loongarch64/tree/master/llm/patches
Author
Owner

@HougeLangley commented on GitHub (May 29, 2024):

ollama-loongarch64-build-full-log.log.txt

<!-- gh-comment-id:2137232205 --> @HougeLangley commented on GitHub (May 29, 2024): [ollama-loongarch64-build-full-log.log.txt](https://github.com/ollama/ollama/files/15483831/ollama-loongarch64-build-full-log.log.txt)
Author
Owner

@HougeLangley commented on GitHub (May 29, 2024):

Hello everyone, the official 'llama.cpp' now supports LASX and LSX extensions as well. However, every time during the 'go build .' phase, this error occurs:

houge@LoongArch-Gentoo ~/ollama-loongarch64 (master) $ go build .       
# github.com/ollama/ollama
/usr/lib/go/pkg/tool/linux_loong64/link: running loongarch64-unknown-linux-gnu-gcc failed: exit status 1
/usr/lib/gcc/loongarch64-unknown-linux-gnu/14/../../../../loongarch64-unknown-linux-gnu/bin/ld: /tmp/go-link-2425035515/000020.o: in function `_cgo_bc67fad7ee33_Cfunc_llama_model_quantize':
/tmp/go-build/llm.cgo2.c:66:(.text+0x34): undefined reference to `llama_model_quantize'
/usr/lib/gcc/loongarch64-unknown-linux-gnu/14/../../../../loongarch64-unknown-linux-gnu/bin/ld: /tmp/go-link-2425035515/000020.o: in function `_cgo_bc67fad7ee33_Cfunc_llama_model_quantize_default_params':
/tmp/go-build/llm.cgo2.c:83:(.text+0x9c): undefined reference to `llama_model_quantize_default_params'
/usr/lib/gcc/loongarch64-unknown-linux-gnu/14/../../../../loongarch64-unknown-linux-gnu/bin/ld: /tmp/go-link-2425035515/000020.o: in function `_cgo_bc67fad7ee33_Cfunc_llama_print_system_info':
/tmp/go-build/llm.cgo2.c:100:(.text+0x110): undefined reference to `llama_print_system_info'
collect2: 错误:ld 返回 1

I thought it was due to my GCC not having the 'GO' USE flag, so I added it and recompiled with gcc, which didn't work. When running a similar compile on an x86_64 Gentoo virtual machine with its own gcc that also lacks the 'GO' USE flag, the result is successful.

Therefore, my friends, this error from CGO should be resolved how?

<!-- gh-comment-id:2138382499 --> @HougeLangley commented on GitHub (May 29, 2024): Hello everyone, the official 'llama.cpp' now supports LASX and LSX extensions as well. However, every time during the 'go build .' phase, this error occurs: ``` houge@LoongArch-Gentoo ~/ollama-loongarch64 (master) $ go build . # github.com/ollama/ollama /usr/lib/go/pkg/tool/linux_loong64/link: running loongarch64-unknown-linux-gnu-gcc failed: exit status 1 /usr/lib/gcc/loongarch64-unknown-linux-gnu/14/../../../../loongarch64-unknown-linux-gnu/bin/ld: /tmp/go-link-2425035515/000020.o: in function `_cgo_bc67fad7ee33_Cfunc_llama_model_quantize': /tmp/go-build/llm.cgo2.c:66:(.text+0x34): undefined reference to `llama_model_quantize' /usr/lib/gcc/loongarch64-unknown-linux-gnu/14/../../../../loongarch64-unknown-linux-gnu/bin/ld: /tmp/go-link-2425035515/000020.o: in function `_cgo_bc67fad7ee33_Cfunc_llama_model_quantize_default_params': /tmp/go-build/llm.cgo2.c:83:(.text+0x9c): undefined reference to `llama_model_quantize_default_params' /usr/lib/gcc/loongarch64-unknown-linux-gnu/14/../../../../loongarch64-unknown-linux-gnu/bin/ld: /tmp/go-link-2425035515/000020.o: in function `_cgo_bc67fad7ee33_Cfunc_llama_print_system_info': /tmp/go-build/llm.cgo2.c:100:(.text+0x110): undefined reference to `llama_print_system_info' collect2: 错误:ld 返回 1 ``` I thought it was due to my GCC not having the 'GO' USE flag, so I added it and recompiled with gcc, which didn't work. When running a similar compile on an x86_64 Gentoo virtual machine with its own gcc that also lacks the 'GO' USE flag, the result is successful. Therefore, my friends, this error from CGO should be resolved how?
Author
Owner

@vincentmli commented on GitHub (Jan 31, 2025):

Hi @HougeLangley I found this issue when I am trying to get ollama for loongarch64, any progress on this?

[root@fedora ~]# curl -fsSL https://ollama.com/install.sh | sh
ERROR: Unsupported architecture: loongarch64
<!-- gh-comment-id:2627801062 --> @vincentmli commented on GitHub (Jan 31, 2025): Hi @HougeLangley I found this issue when I am trying to get ollama for loongarch64, any progress on this? ``` [root@fedora ~]# curl -fsSL https://ollama.com/install.sh | sh ERROR: Unsupported architecture: loongarch64 ```
Author
Owner

@HougeLangley commented on GitHub (Feb 1, 2025):

Hi @HougeLangley I found this issue when I am trying to get ollama for loongarch64, any progress on this?

[root@fedora ~]# curl -fsSL https://ollama.com/install.sh | sh
ERROR: Unsupported architecture: loongarch64

I'm very sorry, currently ollama does not officially support LoongArch. They also do not have a computer with the LoongArch architecture to conveniently build binary packages. Currently, you can try building it locally from source code. However, I am unsure if it will run successfully as I haven't looked into this in detail for quite some time.

<!-- gh-comment-id:2628958732 --> @HougeLangley commented on GitHub (Feb 1, 2025): > Hi [@HougeLangley](https://github.com/HougeLangley) I found this issue when I am trying to get ollama for loongarch64, any progress on this? > > ``` > [root@fedora ~]# curl -fsSL https://ollama.com/install.sh | sh > ERROR: Unsupported architecture: loongarch64 > ``` I'm very sorry, currently ollama does not officially support LoongArch. They also do not have a computer with the LoongArch architecture to conveniently build binary packages. Currently, you can try building it locally from source code. However, I am unsure if it will run successfully as I haven't looked into this in detail for quite some time.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#64890