bazel “undeclared inclusion(s)” errors after updating gcc

柔情痞子 提交于 2019-12-20 04:35:27

问题


After updating from gcc-7.1 to gcc-7.2 I'm getting a lot of errors about undeclared inclusions of standard library headers. For example

$ bazel build //test:my_test
ERROR: /home/haining/my_project/BUILD:39:1: undeclared inclusion(s) in rule '//test:my_test':
this rule is missing dependency declarations for the following files included by 'test/test_range.cpp':
  '/home/haining/gcc-7.2/include/c++/7.2.0/cstddef'
  '/home/haining/gcc-7.2/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/c++config.h'
  '/home/haining/gcc-7.2/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/os_defines.h'
  '/home/haining/gcc-7.2/include/c++/7.2.0/x86_64-pc-linux-gnu/bits/cpu_defines.h'
  '/home/haining/gcc-7.2/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/stddef.h'
  '/home/haining/gcc-7.2/include/c++/7.2.0/functional'
  '/home/haining/gcc-7.2/include/c++/7.2.0/bits/stl_function.h'
  '/home/haining/gcc-7.2/include/c++/7.2.0/bits/move.h'
  '/home/haining/gcc-7.2/include/c++/7.2.0/bits/concept_check.h'
  '/home/haining/gcc-7.2/include/c++/7.2.0/type_traits'
  '/home/haining/gcc-7.2/include/c++/7.2.0/backward/binders.h'
  '/home/haining/gcc-7.2/include/c++/7.2.0/new'
  '/home/haining/gcc-7.2/include/c++/7.2.0/exception'
... etc ...

How can I fix this


回答1:


Whenever you do smth to your system that Bazel cannot possibly know, it's a good idea to run bazel clean --expunge. It's just a little bit more polite way of doing rm -rf ~/.cache/bazel :)




回答2:


Not sure if this is the right solution, but I was able to get this to work by deleting my whole bazel cache directory with

$ rm -rf ~/.cache/bazel

I'm not sure what other effects this has, there's probably something better, what I did feels like a sledgehammer



来源:https://stackoverflow.com/questions/48155976/bazel-undeclared-inclusions-errors-after-updating-gcc

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!