问题描述

运行 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. Chrome Extensions v3 迁移清单

    一.前置问题 1.1为什么需要迁移 v3? Chrome 计划完全停止 v2 版本维护,后续 v2 版本将无法上架谷歌插件商店,除此之外,未来新版本 Chrome 对于 v2 版本插件的限制会越来越大 ...

  2. 深度学习 YOLO v1 源码+笔记

    """ Yolo V1 by tensorflow """ import numpy as np import tensorflow._ap ...

  3. 基本操作:vscode-git使用和命令

      Git简介     GIt /git/ 是一个开源的分布式版本控制系统,可以有效.高速的处理从很小到很大的项目版本管理:      通俗的说,解决的问题是: 正常开发,一个团队需要很多人来共同开发 ...

  4. 每天5分钟复习OpenStack(四) virsh 常用命令

    在上一章节中,我们拉起了第一台虚拟机,但是执行virsh shutdown 关机是无法关机的,需要使用virsh destroy 强制断电的命令来关机.为什么会这样了? 这里我们介绍下 QGA的概念 ...

  5. Util应用框架快速入门(4) - 集成测试开发入门

    本文演示Util应用框架开发的项目中如何编写集成测试. 准备 完成 Web Api 快速入门,本文将在之前生成的示例项目上讲解集成测试的开发. 测试概述 自动化测试对于Util应用框架的开发非常重要, ...

  6. Visual Studio vs2010到2022各个版本的的永久激活密钥

    前言 以下密钥均收集于网络,但均可以正常激活 VS2022专业版和企业版的密钥 Visual Studio 2022 Pro(专业版) TD244-P4NB7-YQ6XK-Y8MMM-YWV2J Vi ...

  7. 高精度减法(C语言实现)

    高精度减法(C语言实现) 介绍 众所周知,整数在C和C++中以int ,long,long long三种不同大小的数据存储,数据大小最大可达2^64,但是在实际使用中,我们仍不可避免的会遇到爆long ...

  8. 2021北京智源大会SNN部分

    神经形态视觉计算 当前问题: spikes vs bits (脉冲 vs 位) meurons vs memory (神经元 vs 计算单元)(真空管vacuum tube,晶体管transistor ...

  9. BABYRE

    一道SMC,第一次做 主函数的伪代码,judge函数是关键函数,不过啥都没有 发现 judge 方法是判断的主要逻辑,在第 15 行时调用判断. 但是静态分析时不能生成 judge 的伪代码. 原因是 ...

  10. HDL刷题:Edgedetect

    原题链接 一道想了好久的题目,在这种并行执行的程序里怎么才能保存前一个状态,看了题解后才发觉,非阻塞赋值啊,代码如下: module top_module ( input clk, input [7: ...