Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to compile go-algorand on M1 #4362

Closed
pbennett opened this issue Aug 5, 2022 · 5 comments
Closed

Unable to compile go-algorand on M1 #4362

pbennett opened this issue Aug 5, 2022 · 5 comments
Assignees

Comments

@pbennett
Copy link

pbennett commented Aug 5, 2022

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/swagger@v0.25.0
+ OUTPUT='# golang.org/x/sys/unix
../../../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20200625212154-ddb9806d33ae/unix/syscall_darwin.1_13.go:29:3: //go:linkname must refer to declared function or variable
../../../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20200625212154-ddb9806d33ae/unix/zsyscall_darwin_arm64.1_13.go:27:3: //go:linkname must refer to declared function or variable
../../../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20200625212154-ddb9806d33ae/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/oapi-codegen@v1.3.7
+ OUTPUT='# golang.org/x/sys/unix
../../../../../go/pkg/mod/golang.org/x/sys@v0.0.0-20200413165638-669c56c373c4/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
@onetechnical
Copy link
Contributor

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.)

@pbennett
Copy link
Author

pbennett commented Aug 9, 2022

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

@PabloLION
Copy link

same problem here. also tried with 1.17

@pbennett
Copy link
Author

This is still broken - did new attempt to today w/ master at 4631571 and got:

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

@pbennett
Copy link
Author

I finally spent some more time trying to track this down and determined the issue was one of a prior amd64 version of 'make' being at fault (likely from MigrationAssistant ported homebrew install - going from prior Intel MB to M1 MB). Looking at debug build output showed that amd64 version of libsodium was being built instead of arm64, and the build then failing because CGO was looking for import in arm build directory (and it wasn't present).
Removing old directory and reinstalling make/updating paths fixed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants