sourcegraph / scip-clang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Standard headers not found on Ubuntu 22.04

varungandhi-src opened this issue · comments

They're under /usr/include/c++/11 with gcc 11, but running into an error when indexing scip-clang itself. #373 (comment)

indexer/Preprocessing.cc:1:10: fatal error: 'optional' file not found
#include <optional>
         ^~~~~~~~~~

With scip-clang v0.2.0 attempting to index scip-clang v0.2.0. Works fine on macOS

One potential thing we can do is to add an extra include -I<resource dir>/../../../include/c++/<version>/ where the <version> is obtained from the last component of the resource dir. (EDIT: This is insufficient, as __config_site comes from a target dependent directory...)

The actual logic is more complicated... https://sourcegraph.com/github.com/llvm/llvm-project@1f8a33c19c79fd4649a07eb70ea394c60a8ce316/-/blob/clang/lib/Driver/ToolChains/Gnu.cpp?L3049-3246

I don't think adding a hack here is the right thing, it seems like the headers should be found, since a tool invocation constructs a driver, which then performs the argument translation. See ToolInvocation.run() -> Driver::BuildCompilation

Tested that scip-clang also works against compilation database for GCC based Bazel toolchains like aspect-build/gcc-toolchain against the https://github.com/aurora-opensource/au repository.