mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 18:02:24 +00:00
Build requires Go >= 1.7
Fix build error on Go >= 1.10
This commit is contained in:
parent
10de057c5d
commit
7923e2274d
4 changed files with 33 additions and 31 deletions
24
.travis.yml
24
.travis.yml
|
|
@ -5,23 +5,27 @@ matrix:
|
||||||
include:
|
include:
|
||||||
- os: linux
|
- os: linux
|
||||||
dist: trusty
|
dist: trusty
|
||||||
go: 1.5.4
|
go: 1.7.5
|
||||||
env:
|
|
||||||
- GO15VENDOREXPERIMENT=1
|
# These are the latest Go versions, only run go vet and misspell on these
|
||||||
- os: linux
|
- os: linux
|
||||||
dist: trusty
|
dist: trusty
|
||||||
go: 1.6.2
|
go: 1.8
|
||||||
- os: linux
|
script:
|
||||||
dist: trusty
|
- go run build/ci.go install
|
||||||
go: 1.7.4
|
- go run build/ci.go test -coverage -vet -misspell
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
go: 1.7.4
|
go: 1.8
|
||||||
|
script:
|
||||||
|
- go run build/ci.go install
|
||||||
|
- go run build/ci.go test -coverage -vet -misspell
|
||||||
|
|
||||||
# This builder does the Ubuntu PPA and Linux Azure uploads
|
# This builder does the Ubuntu PPA and Linux Azure uploads
|
||||||
- os: linux
|
- os: linux
|
||||||
dist: trusty
|
dist: trusty
|
||||||
sudo: required
|
sudo: required
|
||||||
go: 1.7.4
|
go: 1.8
|
||||||
env:
|
env:
|
||||||
- ubuntu-ppa
|
- ubuntu-ppa
|
||||||
- azure-linux
|
- azure-linux
|
||||||
|
|
@ -90,7 +94,7 @@ matrix:
|
||||||
|
|
||||||
# This builder does the OSX Azure, iOS CocoaPods and iOS Azure uploads
|
# This builder does the OSX Azure, iOS CocoaPods and iOS Azure uploads
|
||||||
- os: osx
|
- os: osx
|
||||||
go: 1.7.4
|
go: 1.8
|
||||||
env:
|
env:
|
||||||
- azure-osx
|
- azure-osx
|
||||||
- azure-ios
|
- azure-ios
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ For prerequisites and detailed build instructions please read the [Ethereum's In
|
||||||
|
|
||||||
*Note*: Keep in mind that Ubiq aims to be 100% compatible with Ethereum, so mostly all the documentation you can find on Ethereum wiki, will apply for sure to Ubiq.
|
*Note*: Keep in mind that Ubiq aims to be 100% compatible with Ethereum, so mostly all the documentation you can find on Ethereum wiki, will apply for sure to Ubiq.
|
||||||
|
|
||||||
Building gubiq requires both a Go and a C compiler. You can install them using your favourite package manager. Once the dependencies are installed, run
|
Building gubiq requires both a Go and a C compiler (version 1.7 or later). You can install them using your favourite package manager. Once the dependencies are installed, run
|
||||||
|
|
||||||
make gubiq
|
make gubiq
|
||||||
|
|
||||||
|
|
|
||||||
35
build/ci.go
35
build/ci.go
|
|
@ -157,11 +157,17 @@ func doInstall(cmdline []string) {
|
||||||
|
|
||||||
// Check Go version. People regularly open issues about compilation
|
// Check Go version. People regularly open issues about compilation
|
||||||
// failure with outdated Go. This should save them the trouble.
|
// failure with outdated Go. This should save them the trouble.
|
||||||
if runtime.Version() < "go1.4" && !strings.HasPrefix(runtime.Version(), "devel") {
|
if !strings.Contains(runtime.Version(), "devel") {
|
||||||
log.Println("You have Go version", runtime.Version())
|
// Figure out the minor version number since we can't textually compare (1.10 < 1.7)
|
||||||
log.Println("go-ubiq requires at least Go version 1.4 and cannot")
|
var minor int
|
||||||
log.Println("be compiled with an earlier version. Please upgrade your Go installation.")
|
fmt.Sscanf(strings.TrimPrefix(runtime.Version(), "go1."), "%d", &minor)
|
||||||
os.Exit(1)
|
|
||||||
|
if minor < 7 {
|
||||||
|
log.Println("You have Go version", runtime.Version())
|
||||||
|
log.Println("go-ethereum requires at least Go version 1.7 and cannot")
|
||||||
|
log.Println("be compiled with an earlier version. Please upgrade your Go installation.")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Compile packages given as arguments, or everything if there are no arguments.
|
// Compile packages given as arguments, or everything if there are no arguments.
|
||||||
packages := []string{"./..."}
|
packages := []string{"./..."}
|
||||||
|
|
@ -214,16 +220,9 @@ func buildFlags(env build.Environment) (flags []string) {
|
||||||
flags = append(flags, "-tags", "opencl")
|
flags = append(flags, "-tags", "opencl")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since Go 1.5, the separator char for link time assignments
|
|
||||||
// is '=' and using ' ' prints a warning. However, Go < 1.5 does
|
|
||||||
// not support using '='.
|
|
||||||
sep := " "
|
|
||||||
if runtime.Version() > "go1.5" || strings.Contains(runtime.Version(), "devel") {
|
|
||||||
sep = "="
|
|
||||||
}
|
|
||||||
// Set gitCommit constant via link-time assignment.
|
// Set gitCommit constant via link-time assignment.
|
||||||
if env.Commit != "" {
|
if env.Commit != "" {
|
||||||
flags = append(flags, "-ldflags", "-X main.gitCommit"+sep+env.Commit)
|
flags = append(flags, "-ldflags", "-X main.gitCommit="+env.Commit)
|
||||||
}
|
}
|
||||||
return flags
|
return flags
|
||||||
}
|
}
|
||||||
|
|
@ -240,14 +239,14 @@ func goToolArch(arch string, subcmd string, args ...string) *exec.Cmd {
|
||||||
if subcmd == "build" || subcmd == "install" || subcmd == "test" {
|
if subcmd == "build" || subcmd == "install" || subcmd == "test" {
|
||||||
// Go CGO has a Windows linker error prior to 1.8 (https://github.com/golang/go/issues/8756).
|
// Go CGO has a Windows linker error prior to 1.8 (https://github.com/golang/go/issues/8756).
|
||||||
// Work around issue by allowing multiple definitions for <1.8 builds.
|
// Work around issue by allowing multiple definitions for <1.8 builds.
|
||||||
if runtime.GOOS == "windows" && runtime.Version() < "go1.8" {
|
var minor int
|
||||||
|
fmt.Sscanf(strings.TrimPrefix(runtime.Version(), "go1."), "%d", &minor)
|
||||||
|
|
||||||
|
if runtime.GOOS == "windows" && minor < 8 {
|
||||||
cmd.Args = append(cmd.Args, []string{"-ldflags", "-extldflags -Wl,--allow-multiple-definition"}...)
|
cmd.Args = append(cmd.Args, []string{"-ldflags", "-extldflags -Wl,--allow-multiple-definition"}...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cmd.Env = []string{
|
cmd.Env = []string{"GOPATH=" + build.GOPATH()}
|
||||||
"GO15VENDOREXPERIMENT=1",
|
|
||||||
"GOPATH=" + build.GOPATH(),
|
|
||||||
}
|
|
||||||
if arch == "" || arch == runtime.GOARCH {
|
if arch == "" || arch == runtime.GOARCH {
|
||||||
cmd.Env = append(cmd.Env, "GOBIN="+GOBIN)
|
cmd.Env = append(cmd.Env, "GOBIN="+GOBIN)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,7 @@ fi
|
||||||
|
|
||||||
# Set up the environment to use the workspace.
|
# Set up the environment to use the workspace.
|
||||||
GOPATH="$workspace"
|
GOPATH="$workspace"
|
||||||
GO15VENDOREXPERIMENT=1
|
export GOPATH
|
||||||
export GOPATH GO15VENDOREXPERIMENT
|
|
||||||
|
|
||||||
# Run the command inside the workspace.
|
# Run the command inside the workspace.
|
||||||
cd "$ethdir/go-ubiq"
|
cd "$ethdir/go-ubiq"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue