Closed meritozh closed 5 years ago
https://github.com/MaskRay/ccls/wiki/Project-Setup#llvm-multirepo
LLVM_COMMON=(-GNinja -DCMAKE_CXX_COMPILER=$HOME/llvm/Stable/bin/clang++ -DCMAKE_C_COMPILER=$HOME/llvm/Stable/bin/clang -DBUILD_SHARED_LIBS=On -DLLVM_ENABLE_LLD=On)
cmake -H. -BRelease -DCMAKE_BUILD_TYPE=Release ${LLVM_COMMON}
cmake -H. -BDebug -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXE_LINKER_FLAGS=-Wl,--gdb-index -DCMAKE_SHARED_LINKER_FLAGS=-Wl,--gdb-index -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DLLVM_OPTIMIZED_TABLEGEN=On -DLLVM_USE_SPLIT_DWARF=On ${LLVM_COMMON}
ln -s Debug/compile_commands.json
or https://github.com/MaskRay/ccls/wiki/Project-Setup#llvm-monorepo
I have run,
cmake -G Ninja ../llvm -DLLVM_APPEND_VC_REV=OFF -DLLVM_ENABLE_PROJECTS="clang;llvm;libcxx;libcxxabi;lld;lldb;clang-tools-extra;libunwind;compiler-rt" -DCMAKE_INSTALL_PREFIX=/Users/gaoge/Develop/dev_tool -DCMAKE_BUILD_TYPE=RelWithDebInfo
Same result.
How I start from to solve this issue?
Your cmake command line should have -DCMAKE_EXPORT_COMPILE_COMMANDS=On
. Then symlink it to the project root.
I enable -DCMAKE_EXPORT_COMPILE_COMMANDS=On
for my Debug build as it (LLVM_ENABLE_ASSERTIONS=on) compiles some code that is not compiled into a Release/RelWithDebInfo build.
Also, take a look at https://github.com/MaskRay/ccls/wiki/Debugging#logs
I have try ninja -t compdb
and -DCMAKE_EXPORT_COMPILE_COMMANDS=On
, same result. I will try to provide more helpful information about this issue.
By the way, you cannot reproduce?
Observed behavior
Expected behavior
No diagnostic
Steps to reproduce
git clone git@github.com:llvm/llvm-project.git
System information