bazel 使用 gtest/gmock 报错 Constraints from @bazel_tools//platforms have been removed
问题描述
运行 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的更多相关文章
- 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 ...
- PHP传引用报错(5.4版本)
php5.3系列版本以及以前版本,传引用没有什么问题,升级到php5.4以后,传引用的地方,全报错 Fatal error: Call-time pass-by-reference has been ...
- Unity打Android包报错总结 长期更新
报错1 Failed to compile resources with the following parameters: -bootclasspath "E:\software\And ...
- 自动布局报错(两条连线冲突):Unable to simultaneously satisfy constraints
这个报错有些长: Unable to simultaneously satisfy constraints. Probably at least one of the constraints i ...
- 【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 ...
- eclipse报错 : One or more constraints have not been satisfied.
当eclipse进行报错时,但是不影响运行时,这种错误一般是编译时的问题 进行修改3个地方,即可完成 一 : 进行修改这三个地方的配置文件,都改成你统一的jdk版本,和你用的Dynamic Web ...
- Eclipse 创建maven项目 报错 one or more constraints have not been satisfied
首先 在 pom.xml > plugins 中添加 <plugin> <groupId>org.apache.maven.plugins</groupId> ...
- spring3 jsp页面使用<form:form modelAttribute="xxxx" action="xxxx">报错,附连接数据库的spring MVC annotation 案例
在写一个使用spring3 的form标签的例子时,一直报错,错误信息为:java.lang.IllegalStateException: Neither BindingResult nor plai ...
- ORA-01157报错"cannot identify/lock data file"解决
sqlplus以管理员方式接入数据库,启动时出现报错,如下: > sqlplus "/as sysdba" SQL> startup ...... ORA-01157: ...
- Android Studio报错view is not constrained
在活动上面创建了两个按钮,在Design上看上去是两个按钮分开的,run一下,按钮就重合在一起了,而且一直报错,这个时候再去看一下Design,两个按钮重在一块,只显示一个按钮.如下图: button ...
随机推荐
- ECS搭建FTP服务
实验云账号,创建资源后生成收起 子用户名称: u-7ngohee5@1111971854401817 子用户密码: Jp1Ho5Aj5Ek5Yx1P AK ID: LTAI5tGc6fVMJj44H4 ...
- About Info-ZIP
LATEST RELEASES: Zip 3.00 was released on 7 July 2008. WiZ 5.03 was released on 11 March 2005. UnZip ...
- CSS 多行文本超链接下划线动效
先看效果 乍一看,是不是感觉很简单,仔细一瞅发现事情好像没有那么简单. 如果十分钟还没想出怎么实现,那就把简历上的"精通css"改成"了解css"-- 大部分人 ...
- STL 迭代器
工作之余看了一下<<accelerated c++>>这本书,挺有意思没,没有一大堆概念,直接就开始一步一步编写代码. 书中时不时会涉及到一些stl的概念,比如容器,算法,迭代 ...
- 从零用VitePress搭建博客教程(6) -– 第三方组件库的使用和VitePress搭建组件库文档
接上一节:从零用VitePress搭建博客教程(5) - 如何自定义页面模板.给页面添加独有的className和使页面标题变成侧边目录? 九.第三方组件库的使用 我们经常看见UI组件库的文档,这里我 ...
- Redis主从复制部署小结
Redis主从 搭建主从架构 单节点Redis的并发能力是有上限的,要进一步提高Redis的并发能力,就需要搭建主从集群,实现读写分离. 主从数据同步原理 全量同步 主从第一次建立连接时,会执行全量同 ...
- PKUSC & GDCPC 2023 游记
离得太近,游记打算扔一起. 有没有神仙面基啊 /kel. PKUSC 2023 Day -? 突然听说不给 NOI Linux,震惊. 前情提要:在从 CSP 开始就全员强制 linux 的 LN 为 ...
- YbtOJ 「动态规划」第5章 状压DP
犹豫了许久还是决定试试始终学不会的状压 dp.(上一次学这东西可能还是两年前的网课,显然当时在摸鱼一句都没听/kk 果然还是太菜. 例题1.种植方案 设 \(f_{i,j}\) 表示第 \(i\) 行 ...
- SNN_STDP
STDP 是一种时间不对称的Hebbian学习形式,由突触前和突触后神经元的脉冲时间的时间相关性引起的.是一种双向Hebbian学习法则. 突触权重变化\(\Delta w\)依赖于突触前脉冲的到达和 ...
- PZthon
一道新式题目,python.exe的分析 这个时候没有思路不要紧,直接wp 先用特别的软件执行.exe程序,就是对.exe进行反编译 然后在反编译脚本的目录写就有了一个打包文件夹 在里面找到文件的.p ...