window下 go-ethereum 编译

本文介绍如何下载并配置 Go 环境来编译 Ethereum 客户端 go-ethereum (geth)。包括下载 Go 和 mingw,设置 go 环境变量,以及使用 goland 工具进行编译的具体步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

go下载,选择windows 64位版本,自己从网上找个地址就好

mingw下载 https://nuwen.net/mingw.html

go环境配置

goroot go的安装路径

gopath 工程的路径 该路径下 gopath\src\github.com\ethereum\go-ethereum 是这样的结构


goland 工具,自己下载一个


编译的话,找到src\github.com\ethereum\go-ethereum\cmd\geth.\main,go 右键run就行了

src\github.com\ethereum\go-ethereum\cmd\evm.\main,go





在linux可以使用“make geth”,那在window下输入什么命令可以达到相应目的,以下是Makefile文件中的内容:“# This Makefile is meant to be used by people that do not usually work # with Go source code. If you know what GOPATH is then you probably # don't need to bother with make. .PHONY: geth all test lint fmt clean devtools help GOBIN = ./build/bin GO ?= latest GORUN = go run #? geth: Build geth. geth: $(GORUN) build/ci.go install ./cmd/geth @echo "Done building." @echo "Run \"$(GOBIN)/geth\" to launch geth." #? all: Build all packages and executables. all: $(GORUN) build/ci.go install #? test: Run the tests. test: all $(GORUN) build/ci.go test #? lint: Run certain pre-selected linters. lint: ## Run linters. $(GORUN) build/ci.go lint #? fmt: Ensure consistent code formatting. fmt: gofmt -s -w $(shell find . -name "*.go") #? clean: Clean go cache, built executables, and the auto generated folder. clean: go clean -cache rm -fr build/_workspace/pkg/ $(GOBIN)/* # The devtools target installs tools required for 'go generate'. # You need to put $GOBIN (or $GOPATH/bin) in your PATH to use 'go generate'. #? devtools: Install recommended developer tools. devtools: env GOBIN= go install golang.org/x/tools/cmd/stringer@latest env GOBIN= go install github.com/fjl/gencodec@latest env GOBIN= go install google.golang.org/protobuf/cmd/protoc-gen-go@latest env GOBIN= go install ./cmd/abigen @type "solc" 2> /dev/null || echo 'Please install solc' @type "protoc" 2> /dev/null || echo 'Please install protoc' #? help: Get more info on make commands. help: Makefile @echo '' @echo 'Usage:' @echo ' make [target]' @echo '' @echo 'Targets:' @sed -n 's/^#?//p' $< | column -t -s ':' | sort | sed -e 's/^/ /'”
最新发布
03-16
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值