系統內容 win10
註:不同windows發布版本安裝過程可能略有不同
環境依賴:
Go, GCC
Go下載地址: https://golang.org/dl/
筆者下載的是1.10.2. 64位版本:
完整下載地址: https://dl.google.com/go/go1.10.2.windows-amd64.msi
安裝:
筆者安裝的路徑為 C:\Go目錄下. 添加 C:\Go\bin到環境變數中.
任意目錄下執行go version,顯示版本號碼則安裝配置成功.
C:\Users\tangshua>go version
go version go1.10.2 windows/amd64
MinGw下載地址 : https://sourceforge.net/projects/mingw-w64/
筆者下載的GW完整下載地址: https://jaist.dl.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe
安裝MinGW:
筆者安裝在D:\mingw-w64,安裝完成後如下. 添加D:\mingw-w64\bin到環境變數中.
Spectrum安裝
下載源檔案
https://github.com/SmartMeshFoundation/Spectrum
筆者放在了D盤.切換到tests目錄. 執行Go test -v
其它點:
執行報錯解決辦法:
1. 將代碼放在Go目錄下.
C:\Go\src\github.com\SmartMeshFoundation\Spectrum
筆者在block_test_util.go代碼中發現如下定義,可能導致相應類庫無法找到而報錯.
import ( "bytes" "encoding/hex" "encoding/json" "fmt" "math/big" "github.com/SmartMeshFoundation/Spectrum/common" "github.com/SmartMeshFoundation/Spectrum/common/hexutil" "github.com/SmartMeshFoundation/Spectrum/common/math" "github.com/SmartMeshFoundation/Spectrum/consensus/ethash" "github.com/SmartMeshFoundation/Spectrum/core" "github.com/SmartMeshFoundation/Spectrum/core/state" "github.com/SmartMeshFoundation/Spectrum/core/types" "github.com/SmartMeshFoundation/Spectrum/core/vm" "github.com/SmartMeshFoundation/Spectrum/ethdb" "github.com/SmartMeshFoundation/Spectrum/params" "github.com/SmartMeshFoundation/Spectrum/rlp")
2. 在tests目錄下建立testdata目錄,同時在testdata目錄下分別建立
BlockchainTests,GeneralStateTests,TransactionTests,VMTests,RLPTests,BasicTests目錄。
筆者在init_test.go 檔案中發現如下定義:
var ( baseDir = filepath.Join(".", "testdata") blockTestDir = filepath.Join(baseDir, "BlockchainTests") stateTestDir = filepath.Join(baseDir, "GeneralStateTests") transactionTestDir = filepath.Join(baseDir, "TransactionTests") vmTestDir = filepath.Join(baseDir, "VMTests") rlpTestDir = filepath.Join(baseDir, "RLPTests") difficultyTestDir = filepath.Join(baseDir, "BasicTests"))
但是並未在檔案夾中發現,因此手動建立了改檔案夾.