Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bazel build error: no such package '@com_github_golang_protobuf//proto' #4

Closed
chenglinzhang opened this issue Jul 11, 2018 · 1 comment

Comments

@chenglinzhang
Copy link

I am using the following command line to build envoy on ppc64le Power 8:

bazel build --copt "-D __linux" @envoy//source/exe:envoy-static

with the same WORKSPACE

go_register_toolchains(go_version="host")

and the GO version is 1.10.3 from https://golang.org/dl/ for ppc64le, and the OS is Ubuntu 16.04.

Am I missing anything? Any hint to pinpoint the error will be appreciated.

ERROR details:

/cache/_bazel_root/b570b5ccd0454dc9af9f65ab1833764d/external/com_lyft_protoc_gen_validate/validate/BUILD:35:1: no such package '@com_github_golang_protobuf//proto': no such package '@io_bazel_rules_go_repository_tools//': failed to build gazelle: # github.com/bazelbuild/bazel-gazelle/cmd/gazelle
/cache/_bazel_root/b570b5ccd0454dc9af9f65ab1833764d/external/go_sdk/pkg/tool/linux_ppc64le/link: running gcc failed: exec: "gcc": executable file not found in $PATH

and referenced by '@com_lyft_protoc_gen_validate//validate:go_default_library'
ERROR: Analysis of target '//source/exe:envoy-static' failed; build aborted: no such package '@com_github_golang_protobuf//proto': no such package '@io_bazel_rules_go_repository_tools//': failed to build gazelle: # github.com/bazelbuild/bazel-gazelle/cmd/gazelle
/cache/_bazel_root/b570b5ccd0454dc9af9f65ab1833764d/external/go_sdk/pkg/tool/linux_ppc64le/link: running gcc failed: exec: "gcc": executable file not found in $PATH

@clnperez
Copy link
Owner

clnperez commented Aug 9, 2018

Sorry I didn't see these! i'll fix my mail notifications. There's a problem in the rules_go where the PATH needs to be fixed for non-x86 architectures. Here's the upstream patch: bazel-contrib/bazel-gazelle#242

However, for earlier versions of rules_go, that logic was in a different place. Here's the workaround for your sandbox in the meantime:

vim $(bazel info output_base)/external/io_bazel_rules_go/go/private/repository_tools.bzl

and patch the PATH like this:

diff --git a/go/private/repository_tools.bzl
b/go/private/repository_tools.bzl
index 4ef1d85..5900aea 100644
--- a/go/private/repository_tools.bzl
+++ b/go/private/repository_tools.bzl
@@ -58,6 +58,7 @@ def _go_repository_tools_impl(ctx):
   env = {
     'GOROOT': str(go_tool.dirname.dirname),
     'GOPATH': str(ctx.path('')),
+    'PATH'  : ctx.os.environ["PATH"],
   }

There's a PR open in the envoy community to get the new rules_go: envoyproxy/envoy#3949

@clnperez clnperez closed this as completed Aug 9, 2018
alexandruavadanii added a commit to alexandruavadanii/rules_go that referenced this issue Mar 4, 2019
Original patch [1], backported based on instructions in [2].

[1] bazel-contrib/bazel-gazelle#242
[2] clnperez/envoy-ppc64le#4

Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants