簡體   English   中英

全新安裝 bazel 無法構建 grpc 1.48.0?

[英]fresh install of bazel fails to build grpc 1.48.0?

我對 grpc 和 bazel 都是全新的,但想在 C++ 中嘗試一下,看看它是否可以替代 thrift,它在每個 C++ 版本中都變得越來越長。

$ gcc --version
gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ bazel --version
INFO: Running bazel wrapper (see //tools/bazel for details), bazel version 4.2.1 will be used instead of system-wide bazel installation.
bazel 4.2.1

https://github.com/grpc/grpc/blob/master/BUILDING.md#linux

當我運行時,雖然我收到有關自動 c++ 工具鏈的錯誤。我已經安裝了所有提到的 apt 包,但現在不知道為什么它看不到 gcc

bazel build :all
INFO: Running bazel wrapper (see //tools/bazel for details), bazel version 4.2.1 will be used instead of system-wide bazel installation.
DEBUG: /home/emcp/.cache/bazel/_bazel_emcp/281ba5a21da7173aa4ab26dbe66e8d65/external/bazel_toolchains/rules/rbe_repo/version_check.bzl:68:14: 
Current running Bazel is ahead of bazel-toolchains repo. Please update your pin to bazel-toolchains repo in your WORKSPACE file.
DEBUG: /home/emcp/.cache/bazel/_bazel_emcp/281ba5a21da7173aa4ab26dbe66e8d65/external/bazel_toolchains/rules/rbe_repo/checked_in.bzl:125:14: rbe_default not using checked in configs; Bazel version 4.2.1 was picked/selected but no checked in config was found in map {"0.20.0": ["8.0.0"], "0.21.0": ["8.0.0"], "0.22.0": ["8.0.0", "9.0.0"], "0.23.0": ["8.0.0", "9.0.0"], "0.23.1": ["8.0.0", "9.0.0"], "0.23.2": ["9.0.0"], "0.24.0": ["9.0.0"], "0.24.1": ["9.0.0"], "0.25.0": ["9.0.0"], "0.25.1": ["9.0.0"], "0.25.2": ["9.0.0"], "0.26.0": ["9.0.0"], "0.26.1": ["9.0.0"], "0.27.0": ["9.0.0"], "0.27.1": ["9.0.0"], "0.28.0": ["9.0.0"], "0.28.1": ["9.0.0"], "0.29.0": ["9.0.0"], "0.29.1": ["9.0.0", "10.0.0"], "1.0.0": ["9.0.0", "10.0.0"], "1.0.1": ["10.0.0"], "1.1.0": ["10.0.0"], "1.2.0": ["10.0.0"], "1.2.1": ["10.0.0"], "2.0.0": ["10.0.0"], "2.1.0": ["10.0.0"], "2.1.1": ["10.0.0", "11.0.0"], "2.2.0": ["11.0.0"], "3.0.0": ["11.0.0"], "3.1.0": ["11.0.0"], "3.2.0": ["11.0.0"], "3.3.0": ["11.0.0"], "3.3.1": ["11.0.0"], "3.4.1": ["11.0.0"], "3.5.0": ["11.0.0"], "3.5.1": ["11.0.0"], "3.6.0": ["11.0.0"], "3.7.0": ["11.0.0"], "3.7.1": ["11.0.0"], "3.7.2": ["11.0.0"], "4.0.0": ["11.0.0"]}
DEBUG: /home/emcp/.cache/bazel/_bazel_emcp/281ba5a21da7173aa4ab26dbe66e8d65/external/bazel_toolchains/rules/rbe_repo/version_check.bzl:68:14: 
Current running Bazel is ahead of bazel-toolchains repo. Please update your pin to bazel-toolchains repo in your WORKSPACE file.
DEBUG: /home/emcp/.cache/bazel/_bazel_emcp/281ba5a21da7173aa4ab26dbe66e8d65/external/bazel_toolchains/rules/rbe_repo/checked_in.bzl:125:14: rbe_msan not using checked in configs; Bazel version 4.2.1 was picked/selected but no checked in config was found in map {"0.20.0": ["8.0.0"], "0.21.0": ["8.0.0"], "0.22.0": ["8.0.0", "9.0.0"], "0.23.0": ["8.0.0", "9.0.0"], "0.23.1": ["8.0.0", "9.0.0"], "0.23.2": ["9.0.0"], "0.24.0": ["9.0.0"], "0.24.1": ["9.0.0"], "0.25.0": ["9.0.0"], "0.25.1": ["9.0.0"], "0.25.2": ["9.0.0"], "0.26.0": ["9.0.0"], "0.26.1": ["9.0.0"], "0.27.0": ["9.0.0"], "0.27.1": ["9.0.0"], "0.28.0": ["9.0.0"], "0.28.1": ["9.0.0"], "0.29.0": ["9.0.0"], "0.29.1": ["9.0.0", "10.0.0"], "1.0.0": ["9.0.0", "10.0.0"], "1.0.1": ["10.0.0"], "1.1.0": ["10.0.0"], "1.2.0": ["10.0.0"], "1.2.1": ["10.0.0"], "2.0.0": ["10.0.0"], "2.1.0": ["10.0.0"], "2.1.1": ["10.0.0", "11.0.0"], "2.2.0": ["11.0.0"], "3.0.0": ["11.0.0"], "3.1.0": ["11.0.0"], "3.2.0": ["11.0.0"], "3.3.0": ["11.0.0"], "3.3.1": ["11.0.0"], "3.4.1": ["11.0.0"], "3.5.0": ["11.0.0"], "3.5.1": ["11.0.0"], "3.6.0": ["11.0.0"], "3.7.0": ["11.0.0"], "3.7.1": ["11.0.0"], "3.7.2": ["11.0.0"], "4.0.0": ["11.0.0"]}
INFO: Repository local_config_cc instantiated at:
  /DEFAULT.WORKSPACE.SUFFIX:368:13: in <toplevel>
  /home/emcp/.cache/bazel/_bazel_emcp/281ba5a21da7173aa4ab26dbe66e8d65/external/bazel_tools/tools/cpp/cc_configure.bzl:184:16: in cc_configure
Repository rule cc_autoconf defined at:
  /home/emcp/.cache/bazel/_bazel_emcp/281ba5a21da7173aa4ab26dbe66e8d65/external/bazel_tools/tools/cpp/cc_configure.bzl:145:30: in <toplevel>
ERROR: An error occurred during the fetch of repository 'local_config_cc':
   Traceback (most recent call last):
        File "/home/emcp/.cache/bazel/_bazel_emcp/281ba5a21da7173aa4ab26dbe66e8d65/external/bazel_tools/tools/cpp/cc_configure.bzl", line 127, column 33, in cc_autoconf_impl
                configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools)
        File "/home/emcp/.cache/bazel/_bazel_emcp/281ba5a21da7173aa4ab26dbe66e8d65/external/bazel_tools/tools/cpp/unix_cc_configure.bzl", line 340, column 23, in configure_unix_toolchain
                cc = _find_generic(repository_ctx, "gcc", "CC", overriden_tools)
        File "/home/emcp/.cache/bazel/_bazel_emcp/281ba5a21da7173aa4ab26dbe66e8d65/external/bazel_tools/tools/cpp/unix_cc_configure.bzl", line 310, column 32, in _find_generic
                auto_configure_fail(msg)
        File "/home/emcp/.cache/bazel/_bazel_emcp/281ba5a21da7173aa4ab26dbe66e8d65/external/bazel_tools/tools/cpp/lib_cc_configure.bzl", line 112, column 9, in auto_configure_fail
                fail("\n%sAuto-Configuration Error:%s %s\n" % (red, no_color, msg))
Error in fail: 
Auto-Configuration Error: Cannot find gcc or CC (clang); either correct your path or set the CC environment variable
ERROR: Error fetching repository: Traceback (most recent call last):
        File "/home/emcp/.cache/bazel/_bazel_emcp/281ba5a21da7173aa4ab26dbe66e8d65/external/bazel_tools/tools/cpp/cc_configure.bzl", line 127, column 33, in cc_autoconf_impl
                configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools)
        File "/home/emcp/.cache/bazel/_bazel_emcp/281ba5a21da7173aa4ab26dbe66e8d65/external/bazel_tools/tools/cpp/unix_cc_configure.bzl", line 340, column 23, in configure_unix_toolchain
                cc = _find_generic(repository_ctx, "gcc", "CC", overriden_tools)
        File "/home/emcp/.cache/bazel/_bazel_emcp/281ba5a21da7173aa4ab26dbe66e8d65/external/bazel_tools/tools/cpp/unix_cc_configure.bzl", line 310, column 32, in _find_generic
                auto_configure_fail(msg)
        File "/home/emcp/.cache/bazel/_bazel_emcp/281ba5a21da7173aa4ab26dbe66e8d65/external/bazel_tools/tools/cpp/lib_cc_configure.bzl", line 112, column 9, in auto_configure_fail
                fail("\n%sAuto-Configuration Error:%s %s\n" % (red, no_color, msg))
Error in fail: 
Auto-Configuration Error: Cannot find gcc or CC (clang); either correct your path or set the CC environment variable
INFO: Repository com_google_absl instantiated at:
  /home/emcp/Dev/git/grpc/grpc/WORKSPACE:5:10: in <toplevel>
  /home/emcp/Dev/git/grpc/grpc/bazel/grpc_deps.bzl:295:21: in grpc_deps
Repository rule http_archive defined at:
  /home/emcp/.cache/bazel/_bazel_emcp/281ba5a21da7173aa4ab26dbe66e8d65/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in <toplevel>
ERROR: /home/emcp/Dev/git/grpc/grpc/BUILD:1489:16: //:activity depends on @local_config_cc//:cc-compiler-k8 in repository @local_config_cc which failed to fetch. no such package '@local_config_cc//': 
Auto-Configuration Error: Cannot find gcc or CC (clang); either correct your path or set the CC environment variable
ERROR: Analysis of target '//:activity' failed; build aborted: Analysis failed
INFO: Elapsed time: 0.517s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)

如此所述,臨時解決方法是將 cc 工具鏈從local更改為local_linux in (your home)/.cache/bazel/bazel(your name)/(your hash)/external/local_config_cc/BUILD

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM