sourcegraph / lsif-clang

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

no output produced for seemingly well-formed compile_commands.json #4

Closed shrouxm closed 3 years ago

shrouxm commented 4 years ago

technical details are private, but the gist is that the tool builds successfully, and a compile_commands is generated by the user's distributed build system. when the tool is run, no frontend compilation occurs and the output dump.lsif contains only a meta and project vertex. nothing looks suspicious in the compile_commands.json, but some details to note:

aidaeology commented 4 years ago

@gbrik What is the status of this issue, was this resolved with the 3.20 milestone or does it still need work? If it's resolved and longer a problem then please mark as closed and link the relevant PR. Otherwise please provide a status update here on what the remaining work is to get it resolved.

shrouxm commented 4 years ago

I need to reach out to the user to set up a call so we can work together on this, as I haven't been able to reproduce the issue async.

suo commented 4 years ago

I have a similar issue, maybe mine is a bit easier to repro since the code is public (PyTorch). This is my dump.lsif: dump.lsif.zip

To repro (linux):

  1. Follow the instructions to install dependencies and get the source: https://github.com/pytorch/pytorch#install-dependencies
  2. Use the following build command to build a minimal thing:
    BUILD_TESTS=0 BUILD_CAFFE2_OPS=0 USE_OPENMP=0 USE_MKL=0 USE_MKLDNN=0 USE_NNPACK=0 USE_XNNPACK=0 USE_QNNPACK=0 USE_PYTORCH_QNNPACK=0 USE_FBGEMM=0 USE_DISTRIBUTED=0 USE_CUDA=0 python setup.py develop
  3. The previous command will automatically create compile_commands.json.

The output of lsif-clang seems reasonable, it looks like it's properly processing files. But the lsif.dump is effectively empty. Another thing of note is that I use clangd as an LSP and that works. Let me know if this is helpful.

shrouxm commented 4 years ago

Hi @suo, thanks for reporting! Yours might be a slightly different issue than the one reported above, since in the original case it looked like lsif-clang wasn't doing any processing at all.

Having said that, I was able to produce an index for pytorch using the build command you posted and then running lsif-clang compile_commands.json in the project's root. Could you post exactly how you're invoking lsif-clang? The most likely culprit I can think of is if the project-root argument isn't set correctly (lsif-clang drops all data outside of this root, if it's unset it uses the working directory).

I also just pushed a quick commit so that if you run lsif-clang --debug compile_commands.json it should show you what lsif-clang is trying to use as the project root.

shrouxm commented 3 years ago

It turned out this issue was due to a compile_flags.txt in a parent directory, will be closed by updating documentation.