1.1.3 Windows

优质
小牛编辑
122浏览
2023-12-01

从Chocolatey安装

对于master分支:

choco install geth-stable

有关更多信息,请参阅https://chocolatey.org/packages/geth-stable

对于develop分支:

choco install geth-latest

有关更多信息,请参阅https://chocolatey.org/packages/geth-latest

从源文件构建

  1. 从http://git-scm.com/downloads 下载安装Git

  2. 从https://storage.googleapis.com/golang/go1.4.2.windows-amd64.msi 下载安装Golang

  3. 从http://win-builds.org/1.5.0/win-builds-1.5.0.exe 下载winbuilds,安装到c:\winbuilds

  4. 在此处运行win。删除像QT和GTK这样不需要的大型依赖关系是安全的。应确定依赖关系的确切列表

  5. 设置环境路径

    • 添加GOROOT指向c:\go,GOPATH指向c:\godev(你可以自由挑选这些路径)
    • 设置PATH%PATH%;%GOROOT%\bin;%GOPATH%\bin;c:\winbuilds\bin
  6. 打开终端并先安装godep:go get -u github.com/tools/godep

  7. 打开终端并下载go-elhereum go get -d -u github.com/ethereum/go-ethereum

  8. 尝试用go dep构建ethereum,切换至c:\godev\src\github.com\ethereum\go-ethereum\cmd\geth,然后运行git checkout develop && godep go install

如果你想绕过godep go install使用其他分支构建go install,请手动检查依赖关系。

在Cygwin环境中使用Powershell脚本构建

警告:此安装方法目前无法正确链接。给出消息“ld:找不到-lmingwex”和“ld:找不到-lmingw32”

#REQUIRES -Version 3.0
# Set local directory paths
$basedir = $env:USERPROFILE
$downloaddir = "$basedir\Downloads"

# Set Go variables
$golangroot = "$basedir\golang"
$gosrcroot = "$basedir\go"
$golangdl = "https://storage.googleapis.com/golang/"

# Set cygwin variables
$cygwinroot = "$basedir\cygwin"
$cygwinpackages = "gcc-g++,binutils,make,git,gmp,libgmp10,libgmp-devel"
$cygwinmirror = "http://cygwin.mirrorcatalogs.com"
$cygwindl = "https://cygwin.com/"

# Finalize paths based on processor architecture
if ($ENV:PROCESSOR_ARCHITECTURE -eq "AMD64") {
  $golangdl = $golangdl + "go1.5.1.windows-amd64.zip"
  $cygwindl = $cygwindl + "setup-x86_64.exe"
} else {
  $golangdl = $golangdl + "go1.5.1.windows-386.zip"
  $cygwindl = $cygwindl + "setup-x86.exe"
}

# Download dependencies
Invoke-WebRequest $cygwindl -UseBasicParsing -OutFile "$downloaddir\cygwin-setup.exe"
Invoke-WebRequest $golangdl -UseBasicParsing -OutFile "$downloaddir\golang.zip"

# Install Cygwin & dependencies
Invoke-Expression "$downloaddir\cygwin-setup.exe --root $cygwinroot --site $cygwinmirror --no-admin --quiet-mode --packages=$cygwinpackages"
# Install Golang
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory("$downloaddir\golang.zip", $golangroot)

# Set environment variables
# Only works locally
$env:GOROOT = "$golangroot\go"
$env:GOPATH = $gosrcroot
$env:PATH = "$env:PATH;$cygwinroot\bin;$golangroot\go\bin;$gosrcroot\bin"
# Only works in new sessions
[Environment]::SetEnvironmentVariable("GOROOT", $env:GOROOT, "User")
[Environment]::SetEnvironmentVariable("GOPATH", $env:GOPATH, "User")
[Environment]::SetEnvironmentVariable("PATH", $env:PATH, "User")


# Download go-ethereum source
go get github.com/tools/godep
git clone https://github.com/ethereum/go-ethereum $env:GOPATH/src/github.com
cd $env:GOPATH/src/github.com/ethereum/go-ethereum
godep go install .\cmd\geth