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

M1 Support: update configure_dev.sh #3808

Closed
winder opened this issue Mar 21, 2022 · 3 comments · Fixed by #3919
Closed

M1 Support: update configure_dev.sh #3808

winder opened this issue Mar 21, 2022 · 3 comments · Fixed by #3919
Assignees

Comments

@winder
Copy link
Contributor

winder commented Mar 21, 2022

Several people at the company have successfully configured their M1 systems to build algod. In this ticket we need to codify those changes in the configure_dev.sh script and perform basic validation. The script has a darwin section for supporting mac hardware, we need to extend it with section for M1 specific configuration.

Acceptance criteria

After running the configure script the following commands should work:

make
make install
@winder
Copy link
Contributor Author

winder commented Mar 28, 2022

From @algojack

I did this since I had notes from previous tries, but not sure if needed:
“brew installs intel and arm packages to different locations and I had to export the arm package path separately”
export CPATH=/opt/homebrew/include
export LIBRARY_PATH=/opt/homebrew/lib

@Eric-Warehime
Copy link
Contributor

The above does work...setting CPATH and LIBRARY_PATH` in the Makefile properly builds go-algroand, but only using golang version 1.17 or greater.
Using go1.16 the following errors occur:

🅸 eric@Algo-Wareheim-MBP ~/g/s/go-algorand (master) [2]> make build
./scripts/check_golang_version.sh build
mkdir -p "/Users/eric/go/src/go-algorand/tmp/go-cache" && \
        touch "/Users/eric/go/src/go-algorand/tmp/go-cache"/file.txt && \
        go install -trimpath --tags "sqlite_unlock_notify sqlite_omit_load_extension "  -ldflags="-X github.com/algorand/go-algorand/config.BuildNumber=142822 -X github.com/algorand/go-algorand/config.CommitHash=12ded27c+ -X github.com/algorand/go-algorand/config.Branch=master -X github.com/algorand/go-algorand/config.DefaultDeadlock=disable -extldflags \"\" -X github.com/algorand/go-algorand/config.Channel=master" ./...
# github.com/algorand/go-algorand/tools/misc
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/cmd/loadgenerator
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/cmd/algokey
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/cmd/netdummy
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/cmd/incorporate
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/cmd/genesis
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/cmd/buildtools
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/cmd/opdoc
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/tools/teal/tealcut
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/tools/teal/dkey/dsign
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/tools/debug/algodump
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/cmd/algoh
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/cmd/kmd
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/cmd/catchupsrv
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/cmd/catchpointdump
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/cmd/dispenser
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/cmd/netgoal
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/cmd/nodecfg
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/cmd/goal
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/cmd/algod
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/cmd/pingpong
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/cmd/tealdbg
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/test/commandandcontrol/cc_agent
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/tools/debug/coroner
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
# github.com/algorand/go-algorand/test/e2e-go/cli/goal/expect/catchpointCatchupWebProxy
/Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: /Users/eric/sdk/go1.16/pkg/tool/darwin_arm64/link: combining dwarf failed: unknown load command 0x80000034 (2147483700)
make: *** [buildsrc] Error 1

It looks to be related to this issue golang/go#47269 (comment)
which links to a golang commit that was reverted on the 1.16 stable release https://go-review.googlesource.com/c/go/+/370554

From what I can tell it seems like this means M1 support for go-algorand is blocked on upgrading go to 1.17 minimum.

@Eric-Warehime
Copy link
Contributor

I got compilation working with go1.16, but I had to set -ldflags=-w which disables DWARF generation. It will produce a working binary, but you cannot use a debugger. Delve fails with could not launch process: decoding dwarf section info at offset 0x0: too short

Because the main reason we want M1 support is for the developer experience, it seems like the correct decision is to bump to go 1.17.

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