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
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 doingrm -rf ~/.cache/bazel
:)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
I'm not sure what other effects this has, there's probably something better, what I did feels like a sledgehammer