go-algorand icon indicating copy to clipboard operation
go-algorand copied to clipboard

Unable to compile go-algorand on M1

Open pbennett opened this issue 2 years ago • 3 comments

Subject of the issue

I'm unable to build go-algorand on the mac M1. My understanding is that some on the team can do this, but it's never worked for me, ever.

I used to build it all the time on prior Intel mac so I'm familiar with the process and familiar with Go.

Your environment

  • Go version: 1.18.2 darwin/arm64
  • HEAD version of go-algorand master branch (rel/etc. don't matter)

Steps to reproduce

  1. Follow the README..
  2. ./scripts/configure_dev.sh works fine
  3. ./scripts/buildtools/install_buildtools.sh works for a number of things but ultimately fails on:
++ go install github.com/go-swagger/go-swagger/cmd/[email protected]
+ OUTPUT='# golang.org/x/sys/unix
../../../../../go/pkg/mod/golang.org/x/[email protected]/unix/syscall_darwin.1_13.go:29:3: //go:linkname must refer to declared function or variable
../../../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.1_13.go:27:3: //go:linkname must refer to declared function or variable
../../../../../go/pkg/mod/golang.org/x/[email protected]/unix/zsyscall_darwin_arm64.1_13.go:40:3: //go:linkname must refer to declared function or variable
...

This version is not compatible with M1s. I don't know how this succeeds for the team on a clean environment. Installing the latest version manually works fine though, ie: go install github.com/go-swagger/go-swagger/cmd/swagger@HEAD

Getting past that, it then fails on:

++ go install github.com/algorand/oapi-codegen/cmd/[email protected]
+ OUTPUT='# golang.org/x/sys/unix
../../../../../go/pkg/mod/golang.org/x/[email protected]/unix/syscall_darwin.1_13.go:25:3: //go:linkname must refer to declared function or variable
...

Fetching HEAD of oapi-codegen doesn't fix the issue.

If I continue on and just try to build w/ make, it builds quite a bit but ultimately fails here:

# github.com/algorand/go-algorand/crypto
crypto/batchverifier.go:160:14: could not determine kind of name for C.crypto_sign_ed25519_open_batch

pbennett avatar Aug 05 '22 19:08 pbennett

We'll take a look, but I think there were some dependency updates needed for golang 1.18 support. (Officially supported is still 1.17.9.)

onetechnical avatar Aug 09 '22 14:08 onetechnical

When I brought this up originally in discord, I had the exact same issues when I tried 1.17.

pbennett avatar Aug 09 '22 16:08 pbennett

same problem here. also tried with 1.17

PabloLION avatar Oct 09 '22 23:10 PabloLION