Skip to content

Commit

Permalink
Mod:修改三个编译问题
Browse files Browse the repository at this point in the history
3.1 bazelbuild#15168

distdir_deps.bzl 文件修改
"abseil-cpp": {
        "archive": "997aaf3a28308eba1b9156aa35ab7bca9688e9f6.tar.gz",
        "sha256": "35f22ef5cb286f09954b7cc4c85b5a3f6221c9d4df6b8c4a1e9d399555b366ee",
        "urls": [
            "https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/997aaf3a28308eba1b9156aa35ab7bca9688e9f6.tar.gz",
            "https://github.com/abseil/abseil-cpp/archive/997aaf3a28308eba1b9156aa35ab7bca9688e9f6.tar.gz",
        ],
        "used_in": [
            "additional_distfiles",
            "test_WORKSPACE_files",
        ],
    },
"com_google_absl": {
        "archive": "20211102.0.tar.gz",
        "sha256": "dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4",
        "urls": [
            "https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz",
            "https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz",
        ],
        "used_in": [
            "additional_distfiles",
            "test_WORKSPACE_files",
        ],
        "strip_prefix": "abseil-cpp-20211102.0",
    },

WORKSPACE 文件增加
# Override the abseil-cpp version defined in grpc_deps(), which doesn't work on latest macOS
# Fixes bazelbuild#15168
dist_http_archive(
    name = "com_google_absl",
)

  3.2 src/main/java/net/starlark/java/eval/EvalUtils.java:399: 错误: 找不到符号
      return s.repeat(n);
              ^
  符号:   方法 repeat(int)
  位置: 类型为String的变量 s

    .bazelrc
     # Enable Bzlmod
     build:bzlmod --experimental_enable_bzlmod
     # TODO(pcloudy): The following should be removed after fixing bazelbuild#14279
     build:bzlmod --crosstool_top=@rules_cc.0.0.1.cc_configure.local_config_cc//:toolchain
     build:bzlmod --xcode_version_config=@rules_cc.0.0.1.cc_configure.local_config_xcode//:host_xcodes

     # Enable Java 11 language features (bazelbuild#14592)
     # Toolchain resolution configuration for Bazel >= 5
     build --java_language_version=11
     build --tool_java_language_version=11
     # Legacy configuration for Bazel <= 4
     build --java_toolchain=@bazel_tools//tools/jdk:toolchain_java11
     build --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_java11
     -------------
     def use_cpp_toolchain(mandatory = True):
         """
         Helper to depend on the c++ toolchain.

         Usage:
         ```
         my_rule = rule(
             toolchains = [other toolchain types] + use_cpp_toolchain(),
         )
         ```

         Args:
           mandatory: Whether or not it should be an error if the toolchain cannot be resolved.
             Currently ignored, this will be enabled when optional toolchain types are added.

         Returns:
           A list that can be used as the value for `rule.toolchains`.
         """
         return [CPP_TOOLCHAIN_TYPE]
  • Loading branch information
linyuqiang-tal committed May 14, 2023
1 parent 63c9238 commit fd4afc4
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 12 deletions.
6 changes: 6 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,12 @@ dist_http_archive(
name = "com_github_grpc_grpc",
)

# Override the abseil-cpp version defined in grpc_deps(), which doesn't work on latest macOS
# Fixes https://github.com/bazelbuild/bazel/issues/15168
dist_http_archive(
name = "com_google_absl",
)

# Projects using gRPC as an external dependency must call both grpc_deps() and
# grpc_extra_deps().
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
Expand Down
25 changes: 13 additions & 12 deletions distdir_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,19 @@ DIST_DEPS = {
"test_WORKSPACE_files",
],
},
"abseil-cpp": {
"archive": "997aaf3a28308eba1b9156aa35ab7bca9688e9f6.tar.gz",
"sha256": "35f22ef5cb286f09954b7cc4c85b5a3f6221c9d4df6b8c4a1e9d399555b366ee",
"urls": [
"https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/997aaf3a28308eba1b9156aa35ab7bca9688e9f6.tar.gz",
"https://github.com/abseil/abseil-cpp/archive/997aaf3a28308eba1b9156aa35ab7bca9688e9f6.tar.gz",
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
},
"com_google_absl": {
"archive": "20211102.0.tar.gz",
"sha256": "dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4",
"urls": [
"https://mirror.bazel.build/github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz",
"https://github.com/abseil/abseil-cpp/archive/refs/tags/20211102.0.tar.gz",
],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
],
"strip_prefix": "abseil-cpp-20211102.0",
},
"zstd-jni": {
"archive": "v1.5.0-4.zip",
"patch_args": ["-p1"],
Expand Down
22 changes: 22 additions & 0 deletions tools/cpp/toolchain_utils.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Returns the toolchain if enabled, and falls back to a toolchain constructed from
the CppConfiguration.
"""

CPP_TOOLCHAIN_TYPE = "@bazel_tools//tools/cpp:toolchain_type"

def find_cpp_toolchain(ctx):
"""
Finds the c++ toolchain.
Expand Down Expand Up @@ -49,3 +51,23 @@ def find_cpp_toolchain(ctx):

# We didn't find anything.
fail("In order to use find_cpp_toolchain, you must define the '_cc_toolchain' attribute on your rule or aspect.")

def use_cpp_toolchain(mandatory = True):
"""
Helper to depend on the c++ toolchain.
Usage:
```
my_rule = rule(
toolchains = [other toolchain types] + use_cpp_toolchain(),
)
```
Args:
mandatory: Whether or not it should be an error if the toolchain cannot be resolved.
Currently ignored, this will be enabled when optional toolchain types are added.
Returns:
A list that can be used as the value for `rule.toolchains`.
"""
return [CPP_TOOLCHAIN_TYPE]

0 comments on commit fd4afc4

Please sign in to comment.