【发布时间】:2018-09-12 17:15:41
【问题描述】:
我正在尝试构建/安装名为 envoy 的项目的依赖项。
项目目录如下所示:
$ ls -salt
total 176
0 drwxr-xr-x. 3 app app 37 Aug 31 13:06 ..
4 drwxrwxr-x. 16 app app 4096 Aug 4 02:28 .
0 drwxrwxr-x. 2 app app 23 Aug 4 02:28 .circleci
4 -rwxrwxr-x. 1 app app 259 Aug 4 02:28 .clang-format
0 drwxrwxr-x. 2 app app 22 Aug 4 02:28 .github
4 -rw-rw-r--. 1 app app 217 Aug 4 02:28 .gitignore
4 -rw-rw-r--. 1 app app 61 Aug 4 02:28 BUILD
4 -rw-rw-r--. 1 app app 433 Aug 4 02:28 CODEOWNERS
4 -rw-rw-r--. 1 app app 139 Aug 4 02:28 CODE_OF_CONDUCT.md
12 -rw-rw-r--. 1 app app 10993 Aug 4 02:28 CONTRIBUTING.md
4 -rw-rw-r--. 1 app app 1421 Aug 4 02:28 DCO
8 -rw-rw-r--. 1 app app 4221 Aug 4 02:28 DEPRECATED.md
4 -rw-rw-r--. 1 app app 2189 Aug 4 02:28 DEVELOPER.md
12 -rw-rw-r--. 1 app app 8202 Aug 4 02:28 GOVERNANCE.md
4 -rw-rw-r--. 1 app app 1718 Aug 4 02:28 ISSUE_TEMPLATE.md
12 -rw-rw-r--. 1 app app 11358 Aug 4 02:28 LICENSE
4 -rw-rw-r--. 1 app app 108 Aug 4 02:28 NOTICE
4 -rw-rw-r--. 1 app app 2923 Aug 4 02:28 OWNERS.md
4 -rw-rw-r--. 1 app app 2211 Aug 4 02:28 PULL_REQUEST_TEMPLATE.md
8 -rw-rw-r--. 1 app app 4844 Aug 4 02:28 README.md
8 -rw-rw-r--. 1 app app 6907 Aug 4 02:28 REPO_LAYOUT.md
16 -rw-rw-r--. 1 app app 13200 Aug 4 02:28 SECURITY_RELEASE_PROCESS.md
12 -rw-rw-r--. 1 app app 12085 Aug 4 02:28 STYLE.md
4 -rw-rw-r--. 1 app app 6 Aug 4 02:28 VERSION
4 -rw-rw-r--. 1 app app 514 Aug 4 02:28 WORKSPACE
4 drwxrwxr-x. 9 app app 4096 Aug 4 02:28 api
4 drwxrwxr-x. 3 app app 4096 Aug 4 02:28 bazel
4 drwxrwxr-x. 4 app app 4096 Aug 4 02:28 ci
4 drwxrwxr-x. 4 app app 4096 Aug 4 02:28 configs
4 drwxrwxr-x. 3 app app 4096 Aug 4 02:28 docs
4 drwxrwxr-x. 8 app app 4096 Aug 4 02:28 examples
0 drwxrwxr-x. 3 app app 18 Aug 4 02:28 include
0 drwxrwxr-x. 2 app app 41 Aug 4 02:28 restarter
0 drwxrwxr-x. 7 app app 70 Aug 4 02:28 source
0 drwxrwxr-x. 3 app app 50 Aug 4 02:28 support
4 drwxrwxr-x. 15 app app 4096 Aug 4 02:28 test
4 drwxrwxr-x. 6 app app 4096 Aug 4 02:28 tools
有两个bazelWORKSPACE文件:
$ find . -iname WORKSPACE
./WORKSPACE
./ci/WORKSPACE
我想我必须从顶层目录构建 bazel 本机依赖项,但我不知道如何指定目标 BUILD 文件。您能否在bazel build 上提供建议
命令来实现它?
编辑: 我正在尝试构建步骤#2 中提到的内容https://github.com/envoyproxy/envoy/blob/master/bazel/README.md
编辑#2:当$ bazel build //source/exe:envoy
我收到以下错误
WARNING: /home/app/.cache/bazel/_bazel_app/93cf2aaa5a193ee1dca34ebc2235b4f8/external/com_github_grpc_grpc/BUILD:1972:1: in srcs attribute of cc_library rule @com_github_grpc_grpc//:grpc_nanopb: please do not import '@com_github_grpc_grpc//third_party/nanopb:pb_common.c' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'grpc_generate_one_off_targets', the error might have been caused by the macro implementation in /home/app/.cache/bazel/_bazel_app/93cf2aaa5a193ee1dca34ebc2235b4f8/external/com_github_grpc_grpc/bazel/grpc_build_system.bzl:172:12
WARNING: /home/app/.cache/bazel/_bazel_app/93cf2aaa5a193ee1dca34ebc2235b4f8/external/com_github_grpc_grpc/BUILD:1972:1: in srcs attribute of cc_library rule @com_github_grpc_grpc//:grpc_nanopb: please do not import '@com_github_grpc_grpc//third_party/nanopb:pb_decode.c' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'grpc_generate_one_off_targets', the error might have been caused by the macro implementation in /home/app/.cache/bazel/_bazel_app/93cf2aaa5a193ee1dca34ebc2235b4f8/external/com_github_grpc_grpc/bazel/grpc_build_system.bzl:172:12
WARNING: /home/app/.cache/bazel/_bazel_app/93cf2aaa5a193ee1dca34ebc2235b4f8/external/com_github_grpc_grpc/BUILD:1972:1: in srcs attribute of cc_library rule @com_github_grpc_grpc//:grpc_nanopb: please do not import '@com_github_grpc_grpc//third_party/nanopb:pb_encode.c' directly. You should either move the file to this package or depend on an appropriate rule there. Since this rule was created by the macro 'grpc_generate_one_off_targets', the error might have been caused by the macro implementation in /home/app/.cache/bazel/_bazel_app/93cf2aaa5a193ee1dca34ebc2235b4f8/external/com_github_grpc_grpc/bazel/grpc_build_system.bzl:172:12
ERROR: /home/app/.cache/bazel/_bazel_app/93cf2aaa5a193ee1dca34ebc2235b4f8/external/io_bazel_rules_go/proto/BUILD.bazel:21:1: no such package '@org_golang_x_net//context': failed to fetch org_golang_x_net: 2018/09/12 03:10:46 unrecognized import path "golang.org/x/net"
and referenced by '@io_bazel_rules_go//proto:go_grpc'
ERROR: Analysis of target '//source/exe:envoy' failed; build aborted: no such package '@org_golang_x_net//context': failed to fetch org_golang_x_net: 2018/09/12 03:10:46 unrecognized import path "golang.org/x/net"
INFO: Elapsed time: 73.577s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (253 packages loaded)
您能否提供进一步的建议?
编辑#3:为了完整起见,我在scl 下运行它,这样我就有了更新的 GCC 版本
- name: "Install envoy dependencies"
yum: name="{{ item }}" state=latest
with_items:
- cmake
- libtool
- libstdc++
- bazel
- centos-release-scl
- devtoolset-7-gcc-c++ # scl enable devtoolset-7 bash
environment:
http_proxy: "{{ prx.http }}"
https_proxy: "{{ prx.https }}"
意思是我通过输入scl enable devtoolset-7 bash 进入shell,然后输入通常的东西
【问题讨论】:
-
你到底想要构建什么?
-
感谢@Jin 对其进行调查,请参阅编辑
标签: bazel