gordonklaus / portaudio

Go bindings for the PortAudio audio I/O library
MIT License
704 stars 95 forks source link

Does not compile for RISC-V architecture #61

Open MatejKovacic opened 1 week ago

MatejKovacic commented 1 week ago

Crosscompiling (GOOS=linux GOARCH=riscv64 go build -o MyApp-riscv) throws an error:

package MyApp
    imports github.com/gordonklaus/portaudio: build constraints exclude all Go files in /home/matej/go/pkg/mod/github.com/gordonklaus/portaudio@v0.0.0-20230709114228-aafa478834f5
gordonklaus commented 1 week ago

Possibly you have CGO_ENABLED=0.

MatejKovacic commented 1 week ago

It seems so.

However, if I run CGO_ENABLED=1 GOOS=linux GOARCH=riscv64 go build -o MyApp-riscv, I get this:

# runtime/cgo
gcc_riscv64.S: Assembler messages:
gcc_riscv64.S:17: Error: no such instruction: `sd x1,-200(sp)'
gcc_riscv64.S:18: Error: no such instruction: `addi sp,sp,-200'
gcc_riscv64.S:19: Error: no such instruction: `sd x8,8(sp)'
gcc_riscv64.S:20: Error: no such instruction: `sd x9,16(sp)'
gcc_riscv64.S:21: Error: no such instruction: `sd x18,24(sp)'
gcc_riscv64.S:22: Error: no such instruction: `sd x19,32(sp)'
gcc_riscv64.S:23: Error: no such instruction: `sd x20,40(sp)'
gcc_riscv64.S:24: Error: no such instruction: `sd x21,48(sp)'
gcc_riscv64.S:25: Error: no such instruction: `sd x22,56(sp)'
gcc_riscv64.S:26: Error: no such instruction: `sd x23,64(sp)'
gcc_riscv64.S:27: Error: no such instruction: `sd x24,72(sp)'
gcc_riscv64.S:28: Error: no such instruction: `sd x25,80(sp)'
gcc_riscv64.S:29: Error: no such instruction: `sd x26,88(sp)'
gcc_riscv64.S:30: Error: no such instruction: `sd x27,96(sp)'
gcc_riscv64.S:31: Error: no such instruction: `fsd f8,104(sp)'
gcc_riscv64.S:32: Error: no such instruction: `fsd f9,112(sp)'
gcc_riscv64.S:33: Error: no such instruction: `fsd f18,120(sp)'
gcc_riscv64.S:34: Error: no such instruction: `fsd f19,128(sp)'
gcc_riscv64.S:35: Error: no such instruction: `fsd f20,136(sp)'
gcc_riscv64.S:36: Error: no such instruction: `fsd f21,144(sp)'
gcc_riscv64.S:37: Error: no such instruction: `fsd f22,152(sp)'
gcc_riscv64.S:38: Error: no such instruction: `fsd f23,160(sp)'
gcc_riscv64.S:39: Error: no such instruction: `fsd f24,168(sp)'
gcc_riscv64.S:40: Error: no such instruction: `fsd f25,176(sp)'
gcc_riscv64.S:41: Error: no such instruction: `fsd f26,184(sp)'
gcc_riscv64.S:42: Error: no such instruction: `fsd f27,192(sp)'
gcc_riscv64.S:45: Error: no such instruction: `mv s1,a0'
gcc_riscv64.S:46: Error: no such instruction: `mv s0,a1'
gcc_riscv64.S:47: Error: no such instruction: `mv a0,a2'
gcc_riscv64.S:48: Error: no such instruction: `jalr ra,s0'
gcc_riscv64.S:49: Error: no such instruction: `jalr ra,s1'
gcc_riscv64.S:51: Error: no such instruction: `ld x1,0(sp)'
gcc_riscv64.S:52: Error: no such instruction: `ld x8,8(sp)'
gcc_riscv64.S:53: Error: no such instruction: `ld x9,16(sp)'
gcc_riscv64.S:54: Error: no such instruction: `ld x18,24(sp)'
gcc_riscv64.S:55: Error: no such instruction: `ld x19,32(sp)'
gcc_riscv64.S:56: Error: no such instruction: `ld x20,40(sp)'
gcc_riscv64.S:57: Error: no such instruction: `ld x21,48(sp)'
gcc_riscv64.S:58: Error: no such instruction: `ld x22,56(sp)'
gcc_riscv64.S:59: Error: no such instruction: `ld x23,64(sp)'
gcc_riscv64.S:60: Error: no such instruction: `ld x24,72(sp)'
gcc_riscv64.S:61: Error: no such instruction: `ld x25,80(sp)'
gcc_riscv64.S:62: Error: no such instruction: `ld x26,88(sp)'
gcc_riscv64.S:63: Error: no such instruction: `ld x27,96(sp)'
gcc_riscv64.S:64: Error: junk `(sp)' after expression
gcc_riscv64.S:64: Error: number of operands mismatch for `fld'
gcc_riscv64.S:65: Error: junk `(sp)' after expression
gcc_riscv64.S:65: Error: number of operands mismatch for `fld'
gcc_riscv64.S:66: Error: junk `(sp)' after expression
gcc_riscv64.S:66: Error: number of operands mismatch for `fld'
gcc_riscv64.S:67: Error: junk `(sp)' after expression
gcc_riscv64.S:67: Error: number of operands mismatch for `fld'
gcc_riscv64.S:68: Error: junk `(sp)' after expression
gcc_riscv64.S:68: Error: number of operands mismatch for `fld'
gcc_riscv64.S:69: Error: junk `(sp)' after expression
gcc_riscv64.S:69: Error: number of operands mismatch for `fld'
gcc_riscv64.S:70: Error: junk `(sp)' after expression
gcc_riscv64.S:70: Error: number of operands mismatch for `fld'
gcc_riscv64.S:71: Error: junk `(sp)' after expression
gcc_riscv64.S:71: Error: number of operands mismatch for `fld'
gcc_riscv64.S:72: Error: junk `(sp)' after expression
gcc_riscv64.S:72: Error: number of operands mismatch for `fld'
gcc_riscv64.S:73: Error: junk `(sp)' after expression
gcc_riscv64.S:73: Error: number of operands mismatch for `fld'
gcc_riscv64.S:74: Error: junk `(sp)' after expression
gcc_riscv64.S:74: Error: number of operands mismatch for `fld'
gcc_riscv64.S:75: Error: junk `(sp)' after expression
gcc_riscv64.S:75: Error: number of operands mismatch for `fld'
gcc_riscv64.S:76: Error: no such instruction: `addi sp,sp,200'
gcc_riscv64.S:78: Error: no such instruction: `jr ra'
gordonklaus commented 1 week ago

Maybe this can help? https://blog.davidburela.com/2020/11/21/cross-compiling-golang-for-risc-v/