[GH-ISSUE #4378] RISCV build Ollama git version: running gcc failed: exit status 1 /usr/bin/ld: /tmp/go-link-2984308571/000019.o: in function `_cgo_d85a20fb2d9c_Cfunc_llama_model_quantize': #49246

Closed
opened 2026-04-28 10:59:26 -05:00 by GiteaMirror · 1 comment
Owner

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

What is the issue?

Full build failed could check here. https://github.com/chewxy/math32/issues/46#issuecomment-2105317191

# sipeed @ lpi4a in ~/ollama on git:main o [1:07:32] C:1
$ go get -u github.com/chewxy/math32@7caa3bb
go: downloading github.com/chewxy/math32 v1.10.2-0.20240509203351-7caa3bba2ee1
go: upgraded github.com/chewxy/math32 v1.10.1 => v1.10.2-0.20240509203351-7caa3bba2ee1

# sipeed @ lpi4a in ~/ollama on git:main x [1:07:50] 
$ go build .                                
# github.com/ollama/ollama
/home/sipeed/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.0.linux-riscv64/pkg/tool/linux_riscv64/link: running gcc failed: exit status 1
/usr/bin/ld: /tmp/go-link-2984308571/000019.o: in function `_cgo_d85a20fb2d9c_Cfunc_llama_model_quantize':
/tmp/go-build/llm.cgo2.c:69: undefined reference to `llama_model_quantize'
/usr/bin/ld: /tmp/go-link-2984308571/000019.o: in function `_cgo_d85a20fb2d9c_Cfunc_llama_model_quantize_default_params':
/tmp/go-build/llm.cgo2.c:86: undefined reference to `llama_model_quantize_default_params'
/usr/bin/ld: /tmp/go-link-2984308571/000019.o: in function `_cgo_d85a20fb2d9c_Cfunc_llama_print_system_info':
/tmp/go-build/llm.cgo2.c:103: undefined reference to `llama_print_system_info'
collect2: 错误:ld 返回 1

OS

Linux

GPU

Other

CPU

Other

Ollama version

0.0.0 git version

Originally created by @HougeLangley on GitHub (May 12, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/4378 ### What is the issue? Full build failed could check here. https://github.com/chewxy/math32/issues/46#issuecomment-2105317191 ``` # sipeed @ lpi4a in ~/ollama on git:main o [1:07:32] C:1 $ go get -u github.com/chewxy/math32@7caa3bb go: downloading github.com/chewxy/math32 v1.10.2-0.20240509203351-7caa3bba2ee1 go: upgraded github.com/chewxy/math32 v1.10.1 => v1.10.2-0.20240509203351-7caa3bba2ee1 # sipeed @ lpi4a in ~/ollama on git:main x [1:07:50] $ go build . # github.com/ollama/ollama /home/sipeed/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.0.linux-riscv64/pkg/tool/linux_riscv64/link: running gcc failed: exit status 1 /usr/bin/ld: /tmp/go-link-2984308571/000019.o: in function `_cgo_d85a20fb2d9c_Cfunc_llama_model_quantize': /tmp/go-build/llm.cgo2.c:69: undefined reference to `llama_model_quantize' /usr/bin/ld: /tmp/go-link-2984308571/000019.o: in function `_cgo_d85a20fb2d9c_Cfunc_llama_model_quantize_default_params': /tmp/go-build/llm.cgo2.c:86: undefined reference to `llama_model_quantize_default_params' /usr/bin/ld: /tmp/go-link-2984308571/000019.o: in function `_cgo_d85a20fb2d9c_Cfunc_llama_print_system_info': /tmp/go-build/llm.cgo2.c:103: undefined reference to `llama_print_system_info' collect2: 错误:ld 返回 1 ``` ### OS Linux ### GPU Other ### CPU Other ### Ollama version 0.0.0 git version
GiteaMirror added the bug label 2026-04-28 10:59:26 -05:00
Author
Owner

@woale commented on GitHub (May 31, 2024):

@HougeLangley , see #4710
Your go build . maybe succeeds after adding the following line to ollama/llm/llm.go ;
// #cgo linux,riscv64 LDFLAGS: ${SRCDIR}/build/linux/riscv64_static/libllama.a -lstdc++

<!-- gh-comment-id:2142293336 --> @woale commented on GitHub (May 31, 2024): @HougeLangley , see #4710 Your `go build .` maybe succeeds after adding the following line to ollama/llm/llm.go ; `// #cgo linux,riscv64 LDFLAGS: ${SRCDIR}/build/linux/riscv64_static/libllama.a -lstdc++`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#49246