Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specially index the C++ standard library #60

Open
varungandhi-src opened this issue Jan 31, 2023 · 0 comments
Open

Specially index the C++ standard library #60

varungandhi-src opened this issue Jan 31, 2023 · 0 comments

Comments

@varungandhi-src
Copy link
Contributor

varungandhi-src commented Jan 31, 2023

Depends on:

Some things to keep in mind, off the top of my head:

  • How do we do it?: Standard libraries largely consist of header files, but there is no meaningful interpretation of indexing/compiling a header file standalone.
    • One hack would be to make a fake C++ project which includes every header in the standard library. This fake C++ project should have multiple files so that indexing runs in parallel.
    • This fake C++ project should be generated instead of being hard-coded so that we can accommodate different stdlib versions and ideally automatically pick up new headers introduced in future stdlib versions.
    • The project root needs to be set to the stdlib root so that stdlib files are treated as in-project and the fake C++ project is ignored.
  • How will the stdlib be available in Sourcegraph: Using a special package in Sourcegraph (e.g. so as to accommodate generated headers) seems like a good option, similar to the JDK. However, we don't have support for C++ packages yet in Sourcegraph.
  • Which stdlib source code do we use?: The options are (i) release tarballs (ii) directly cloning from Git (iii) distro packages (iv) pre-packaged Bazel toolchains. With distro packages, building the code becomes easier (e.g. building libstdc++ from source seems to require building GCC from source, which would be good to avoid). However, distros may potentially apply their own patches to libstdc++. If we use the distro package, we need to figure out how to map the distro package code to the package in Sourcegraph. The same concerns apply to pre-packaged Bazel toolchains.
  • Which stdlibs do we index?: This depends on the answer to the previous question. If we're going with distro packages, one potential problem might be that not every minor stdlib version may be available (or they make take a while to be released).
  • Stdlib identity/version detection: We need to make sure we're tracking the versions
  • Hermetic toolchains with Bazel: If a customer using using a pre-packaged hermetic toolchain with Bazel, like Aspect's GCC toolchain or grailbio's LLVM toolchain, we need to make sure that we're able to map the stdlib identity/version correctly.
  • Custom Bazel toolchains: Are some customers using custom toolchains (e.g. some non-tagged commits in the LLVM repo)? Or their homegrown hermetic toolchain? Depending on the exact setup, we may need some way to pass in extra configuration as a command-line flag or via Bazel.
  • Vendoring: Large projects like Chromium vendor all dependencies, down to the exact version of Clang and libstdc++. Are customers vendoring C++ toolchains like Chromium? If so, we need to think about how to map those into Sourcegraph. (If it's a monorepo, that should probably just work, but it's more likely that the build system is downloading the code on-the-fly.)
@varungandhi-src varungandhi-src added the enhancement New feature or request label Jan 31, 2023
@mmanela mmanela added the Migrated label May 6, 2024 — with Linear
@linear linear bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants