我正在尝试构建/安装名为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
有两个bazel WORKSPACE
文件:
$ find . -iname WORKSPACE
./WORKSPACE
./ci/WORKSPACE
我想我必须从顶层目录构建bazel本机依赖关系,但是我不知道如何指定目标BUILD文件。您能否在bazel build
上提出建议
命令来实现那个目标?
编辑:我正在尝试在此处https://github.com/envoyproxy/envoy/blob/master/bazel/README.md
上构建步骤2中提到的内容。 编辑#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
,然后输入通常的内容
答案 0 :(得分:0)
从DEVELOPER.md开始构建Envoy:
$ bazel build //source/exe:envoy
此//source/exe:envoy
目标在source/exe/BUILD
中定义。
要运行所有测试:
$ bazel test //test/...
...
递归引用所有目标。
要运行特定的测试,例如test/common/http/BUILD
中定义的async_client_impl_test
。 //test/common/http
是程序包名称。
$ bazel test //test/common/http:async_client_impl_test
由于绝对目标标签中的//
,因此可以从项目目录中的任何位置运行这些命令。
答案 1 :(得分:0)
您可以尝试“进入-u google.golang.org/grpc”并查看其是否有效吗?