参考文档:见官网
系统:ubuntu18.04
编译步骤:
1.安装 goclang
下载: https://golang.org/doc/install
解压命令:
tar -C /usr/local -xzf go1.14.2.linux-amd64.tar.gz
配置环境变量命令:
export PATH=$PATH:/usr/local/go/bin
2.安装 Bazel
添加源命令:
sudo apt install curl
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
安装和更新命令:
sudo apt update && sudo apt install bazel
安装1.0.0命令:
sudo apt install bazel-1.0.0
安装jdk命令:
sudo apt install openjdk-11-jdk
(注:如果是ubuntu16,需用命令: sudo apt install openjdk-8-jdk)
3.下载 vt 代码
下载命令:
go get -u -insecure vt.com/core
(注:加-insecure是为了解决 Https跳转的问题)
4.交叉编译vt
编译命令:
cd $(go env GOPATH)/src/vt.com/core/main
env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o $HOME/vt.exe -ldflags "-s -w"