[以太坊] Mac install abigen 安裝abigen
這篇文章本不該有,但是我安裝abigen的經歷實在是太艱辛了,還是記錄下吧。
1. 正確姿勢
先說正確姿勢,希望你能順利。
一般來說,安裝abigen命令,只需要三步就可以搞定的,下載,編譯,安裝。
go get github.com/ethereum/go-ethereum cd $GOPATH/src/github.com/ethereum/go-ethereum/ make make devtools abigen --help
2. 坑一之科學上網
在執行 make devtools
時,需要下載相關依賴,有golang.org的,也有github的,可憐的我一會開一會關,仍然不行,原因是 Makefile
裡是這麼寫的

Makefile
(看到 -u
了吧?你一定看到了!)
了。
3. 坑二之go版本bug
我的機器上,用的是go1.10,在最後一步 go install ./cmd/abigen
時,會遇到一個錯誤
# github.com/ethereum/go-ethereum/cmd/abigen /usr/local/Cellar/go/1.10/libexec/pkg/tool/darwin_amd64/link: /usr/local/Cellar/go/1.10/libexec/pkg/tool/darwin_amd64/link: combining dwarf failed: Unknown load command 0x32 (50)
這個問題坑的我夠嗆,過程十分艱辛,後來終於在github上找到 ofollow,noindex">這個Issue ,原來是Go版本問題,果斷升級到1.11
brew upgrade go
再執行 go install ./cmd/abigen
果然就可以了。
希望對你有用。
另外我維護有一系列開發者社群,如果對Go語言感興趣,可以加妹子微信 grey0805 ,加你進群交流。