问题描述

运行 bazel test 命令,遇到错误:“Constraints from @bazel_tools//platforms have been removed. Please use constraints from @platforms repository embedded in Bazel, or preferably declare dependency on https://github.com/bazelbuild/platforms. See https://github.com/bazelbuild/bazel/issues/8622 for details”

ERROR: /.../bazel_tools/platforms/BUILD:89:6: in alias rule @bazel_tools//platforms:windows: Constraints from @bazel_tools//platforms have been removed. Please use constraints from @platforms repository embedded in Bazel, or preferably declare dependency on https://github.com/bazelbuild/platforms. See https://github.com/bazelbuild/bazel/issues/8622 for details.
ERROR: /.../bazel_tools/platforms/BUILD:89:6: Analysis of target '@bazel_tools//platforms:windows' failed
ERROR: /.../google/BUILD.bazel:113:11: errors encountered resolving select() keys for @google//:gtest_main

问题分析

该错误是项目使用的 gtest 版本太老,里面用了 @bazel_tools//platforms 这种限制形式,而这一用法在新版的 bazel 中已经废弃,改为内置的 @platforms

解决方案

解决办法是更新 gtest 的版本。不同项目可能会有差异,无法直接照搬,这里给出的示例仅供参考。修改 WORKSPACE 文件中引入 gtest 的地方,把 url 换成一个新版 gtest 的地址,同时修改 strip_prefix 字段:

http_archive(
    name = "google",
    strip_prefix = "googletest-5ab508a01f9eb089207ee87fd547d290da39d015",
    url = "https://github.com/google/googletest/archive/5ab508a01f9eb089207ee87fd547d290da39d015.zip",
)

bazel 使用 gtest/gmock 报错 Constraints from @bazel_tools//platforms have been removed的更多相关文章

  1. pandas 使用panel 报错 Panel is deprecated and will be removed in a future version.

    Panel is deprecated and will be removed in a future version.The recommended way to represent these t ...

  2. PHP传引用报错(5.4版本)

    php5.3系列版本以及以前版本,传引用没有什么问题,升级到php5.4以后,传引用的地方,全报错 Fatal error: Call-time pass-by-reference has been ...

  3. Unity打Android包报错总结 长期更新

    报错1  Failed to compile resources with the following parameters: -bootclasspath "E:\software\And ...

  4. 自动布局报错(两条连线冲突):Unable to simultaneously satisfy constraints

    这个报错有些长: Unable to simultaneously satisfy constraints.    Probably at least one of the constraints i ...

  5. 【maven 报错】maven项目update之后报错One or more constraints have not been satisfied.

    在右键项目Update Project之后报错:One or more constraints have not been satisfied.Spring 4.1 requires Java 1.6 ...

  6. eclipse报错 : One or more constraints have not been satisfied.

    当eclipse进行报错时,但是不影响运行时,这种错误一般是编译时的问题 进行修改3个地方,即可完成 一 :  进行修改这三个地方的配置文件,都改成你统一的jdk版本,和你用的Dynamic Web ...

  7. Eclipse 创建maven项目 报错 one or more constraints have not been satisfied

    首先 在 pom.xml > plugins 中添加 <plugin> <groupId>org.apache.maven.plugins</groupId> ...

  8. spring3 jsp页面使用<form:form modelAttribute="xxxx" action="xxxx">报错,附连接数据库的spring MVC annotation 案例

    在写一个使用spring3 的form标签的例子时,一直报错,错误信息为:java.lang.IllegalStateException: Neither BindingResult nor plai ...

  9. ORA-01157报错"cannot identify/lock data file"解决

    sqlplus以管理员方式接入数据库,启动时出现报错,如下: > sqlplus "/as sysdba" SQL> startup ...... ORA-01157: ...

  10. Android Studio报错view is not constrained

    在活动上面创建了两个按钮,在Design上看上去是两个按钮分开的,run一下,按钮就重合在一起了,而且一直报错,这个时候再去看一下Design,两个按钮重在一块,只显示一个按钮.如下图: button ...

随机推荐

  1. python系列:argparse详解 外部传参给python的库

    一.argparse简介 argparse 模块是 Python 内置的用于命令项选项与参数解析的模块,argparse 模块可以让人轻松编写用户友好的命令行接口,能够帮助程序员为模型定义参数. ar ...

  2. vim vimtutor

    =============================================================================== =      歡     迎     閱 ...

  3. 13. 从零开始编写一个类nginx工具, HTTP中的压缩gzip,deflate,brotli算法

    wmproxy wmproxy将用Rust实现http/https代理, socks5代理, 反向代理, 静态文件服务器,后续将实现websocket代理, 内外网穿透等, 会将实现过程分享出来, 感 ...

  4. calico网络异常,不健康

    解决calico/node is not ready: BIRD is not ready: BGP not established withxxx calico有一个没有ready,查了一下是没有发 ...

  5. ELK日志企业案例:(5.3版本)

    1.shell三剑客同居.分析nginx日志: 1)在企业生产环境中,日志内容主要用来做什么? 日志内容主要用于运维人员.开发人员.DBA排错软件服务故障的,因为通过日志内容能够第一时间找到软件服务的 ...

  6. python环境配置常用命令

    #安装前请更新 sudo apt-get update python -m pip install --upgrade pip #升级PIP版本 sudo apt-get install python ...

  7. JVM-JVM如何加载类

    一.Java 语言的类型可以分为两大类: 基本类型(primitive types) 引用类型(reference types):类.接口.数组类和泛型参数(泛型参数会在编译中被擦除),因此Java虚 ...

  8. EFCore 使用FluntApi配置 全局查询筛选器

    我们在类中通常会有一个属性为 IsDel来表示软删除或也称逻辑删除,这个属性会导致我们在进行查询操作时,每一次都要 .where(s=>s.IsDel==false) 非常的麻烦.在使用efCo ...

  9. SpringBoot 项目优雅实现读写分离

    一.读写分离介绍 当使用Spring Boot开发数据库应用时,读写分离是一种常见的优化策略.读写分离将读操作和写操作分别分配给不同的数据库实例,以提高系统的吞吐量和性能. 读写分离实现主要是通过动态 ...

  10. freeRTOS 学习

    一.任务状态 任务状态可以分成 Running 和Not Running: 但实际的Not Running状态还有许多的其他状态作为细分. 包括挂起,阻塞和就绪态 挂起状态表示该任务虽然已经创建但是在 ...