sourcegraph / lsif-clang

Language Server Indexing Format (LSIF) generator for C, C++ and Objective C
https://lsif.dev/
35 stars 8 forks source link

Create successful and reproducible indexes of 20 OSS repos #12

Closed shrouxm closed 3 years ago

shrouxm commented 4 years ago

Steps for everyone:

  1. Find a popular open source C++ repository which is not already documented in this thread. if you can think of one yourself, do that! otherwise here's some lists: GitHub trending, CodeTriage, awesome-cpp.
  2. Follow the documentation on this repo to create an lsif index of the chosen repository. For now, use the simplify-cmake branch. If you're unable to create an index, file a bug documenting what you tried.
  3. Follow the sourcegraph documentation to upload the lsif index to sourcegraph.com, and confirm that the c++ codenav works (feel free to spend lots of time here, C++ is a strange beast so click on some strange code to make sure it's getting indexed properly!)
  4. Document the steps from cloning to successful index creation (not including getting deps for and building lsif-clang)

Steps for Garo:

  1. Reproduce all of the above
efritz commented 4 years ago

Some findings on MacOS 10.15.

nlohmann/json

Running commands

cmake -B build -S . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cp ./build/compile_commands.json .
lsif-clang --extra-arg='-resource-dir=/Library/Developer/CommandLineTools/usr/lib/clang/11.0.3' --executor=all-TUs compile_commands.json > dump.lsif

exits with status 138.

...
[40/50] Processing file /Users/efritz/Downloads/cpptest/json/test/src/unit-to_chars.cpp
[41/50] Processing file /Users/efritz/Downloads/cpptest/json/test/src/unit-inspection.cpp
[42/50] Processing file /Users/efritz/Downloads/cpptest/json/test/src/unit-serialization.cpp
[43/50] Processing file /Users/efritz/Downloads/cpptest/json/test/src/unit-ordered_json.cpp
[44/50] Processing file /Users/efritz/Downloads/cpptest/json/test/src/unit-merge_patch.cpp
[45/50] Processing file /Users/efritz/Downloads/cpptest/json/test/src/unit-reference_access.cpp
[46/50] Processing file /Users/efritz/Downloads/cpptest/json/test/src/unit-assert_macro.cpp
[1]    93496 bus error  lsif-clang  --executor=all-TUs compile_commands.json > dump.lsif

protocolbuffers/protobuf

Running commands

cmake -B buildx -S cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cd buildx
make # NOTE: I ran make here to generate .pb.cc files (probably not necessary in general)
cp ./compile_commands.json ..
cd ../
lsif-clang --extra-arg='-resource-dir=/Library/Developer/CommandLineTools/usr/lib/clang/11.0.3' --executor=all-TUs compile_commands.json > dump.lsif

produces a valid index with 7837653 elements. Passes lsif-validate with 466 overlapping ranges. All of these ranges "kiss", which may be an error in lsif-validate or lsif-clang. I believe the intervals are half-open and this should be fine.

shrouxm commented 4 years ago

FFmpeg/FFmpeg

shrouxm commented 4 years ago

nlohmann/json

shrouxm commented 4 years ago

tensorflow/tensorflow

shrouxm commented 4 years ago

torvalds/linux

shrouxm commented 4 years ago

envoyproxy/envoy

shrouxm commented 4 years ago

grpc/grpc

shrouxm commented 4 years ago

falcosecurity/falco

macraig commented 4 years ago

prabhuomkar/pytorch-cpp