phoreproject / bls

Go implementation of the BLS12-381 pairing
Apache License 2.0
89 stars 31 forks source link

Cannot compile for ARM #4

Closed prestonvanloon closed 5 years ago

prestonvanloon commented 5 years ago

Trying to cross compile for an ARM device and getting this error.

I haven't looked into it yet, logging an issue first.

env GOOS=linux GOARCH=arm  go build
# github.com/phoreproject/bls
./fq.go:78:52: cannot use 0 (type int) as type *uint64 in argument to MACWithCarry
./primitivefuncs.go:5:6: missing function body
./primitivefuncs.go:9:6: missing function body
./primitivefuncs.go:13:6: missing function body
./uint384.go:5:6: MACWithCarry redeclared in this block
        previous declaration at ./primitivefuncs.go:5:72
./uint384.go:5:6: missing function body
./uint384.go:9:6: SubWithBorrow redeclared in this block
        previous declaration at ./primitivefuncs.go:9:64
./uint384.go:9:6: missing function body
./uint384.go:13:6: AddWithCarry redeclared in this block
        previous declaration at ./primitivefuncs.go:13:62
./uint384.go:13:6: missing function body
./fq.go:78:52: too many errors
prestonvanloon commented 5 years ago

Looks like the present assembly files only support amd64.

I think it would be a good idea to have a fallback written in go such that cross compiles would be enabled, albeit less performant than the assembly methods for specific architectures.

prestonvanloon commented 5 years ago

For reference: https://github.com/golang/go/wiki/AssemblyPolicy

meyer9 commented 5 years ago

This is definitely a problem. I'll add some fallback functions for unsupported platforms.

meyer9 commented 5 years ago

Still working on this...

meyer9 commented 5 years ago

Done :)