Closed shrouxm closed 3 years ago
Some findings on MacOS 10.15.
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
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.
./configure
bear make
<unmodified lsif-clang invocation>
cmake -B build -S . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
ln -s $(pwd)/build/compile_commmands.json ./
<unmodified lsif-clang invocation>
./configure
bear -o compile_commands_raw.json bazel build //tensorflow/tools/pip_package:build_pip_package
jq '[ .[] | select(.file | startswith("tensorflow")) ]' compile_commands_raw.json | grep -v -e '-fno-canonical-system-headers' > compile_commands.json
<unmodified lsif-clang invocation>
make allyesconfig
make CC=clang-10 HOSTCC=clang-10
scripts/gen_compile_commands.py
<unmodified lsif-clang invocation>
./bazel/setup_clang.sh /usr/lib/llvm-10 `# or wherever your llvm installation lives`
echo 'build --config=clang' > user.bazelrc
TEST_TMPDIR=/tmp tools/gen_compilation_database.py --include_headers --run_bazel_build
<unmodified lsif-clang invocation>
cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -Dgrpc_BUILD_TESTS=ON -G Ninja
ninja -C build $(grep -e 'build gens' build/build.ninja | awk '{print $2}') `# generate pb`
lsif-clang build/compile_commands.json
sudo apt install git cmake build-essential libncurses-dev pkg-config autoconf libtool libelf-dev -y
sudo apt install libssl-dev libc-ares-dev libprotobuf-dev protobuf-compiler libjq-dev libgrpc++-dev protobuf-compiler-grpc libcurl4-openssl-dev
cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G Ninja
ninja -C build $(egrep -e '^build[^:]+.pb.(cc|h|c|cpp)[: ]' build/build.ninja | awk '{print $2}')
lsif-clang build/compile_commands.json
cmake -B build -DPATH_TO_LLVM=/usr/local/opt/lib
make -j8
../lsif-clang/build/bin/lsif-clang --project-root=$(pwd) --executor=all-TUs compile_commands.json --extra-arg="-resource-dir=$(clang -print-resource-dir)" > dump.lsif
Steps for everyone:
Steps for Garo: