Closed nanikjava closed 4 years ago
Copied main.go
and version.go
to src/gvisor.dev/gvisor/bazel-bin/gopath/src/gvisor.dev/gvisor/runsc/
and compile it with the following command
GOPATH=/home/nanik/Downloads/temp/packages/src/gvisor.dev/gvisor/bazel-bin/gopath GO111MODULE=off go build -o exe gvisor.dev/gvisor/runsc/
it works.
Looks like the problem is bazel for some reasons are not symlinking the main.go and version.go inside runsc/
More info about local bazel installation:
Build label: 3.5.0
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Wed Sep 2 20:11:46 2020 (1599077506)
Build timestamp: 1599077506
Build timestamp as int: 1599077506
I think this is because the :gopath wasn't necessarily intended to be a way to build runsc (or other binaries). But rather a way to export gvisor's library packages so they could be used by an editor like vim-go or VSCode. We don't provide instructions to build from there for that reason.
From https://gvisor.dev/contributing/
If you use this mechanism, keep in mind that the generated tree is not the canonical source. You will still need to build and test with bazel.
I think you'll still want to edit the original files (not via the links in GOPATH) and build using bazel build ...
and set your editor up to do that rather than using the Go compiler directly.
Thanks @ianlewis
Since there is go branch wouldn't it be easier for contributor to work using that branch as you mentioned that it is based on the master branch ?
Maybe this should be mentioned inside the contributing page ?. Happy to take this on if that make sense ?
The following doc https://gvisor.dev/contributing/ outlined the way to generate GOPATH directories allowing developers to use IDE to do gvisor development.
The command
bazel build :gopath
generate the directory structure but when compiling using the following command it produces errorGOPATH=/home/nanik/Downloads/temp/packages/src/gvisor.dev/gvisor/bazel-bin/gopath go build -o exe gvisor.dev/gvisor/runsc
error produced