clangd compilation command - false

461 views
Skip to first unread message

Uday Reddy B

unread,
Aug 13, 2020, 1:00:42 AM8/13/20
to ycm-users
Hello,

For some reason,  I notice that clangd isn't picking compilation commands from the compilation database in one instance. The debug log is appended below. I have the compilation_database_folder set in .ycm_extra_conf.py the following way:

compilation_database_folder = '../build.release'

and the build.release does have a 'compile_commands.json' with the command to compile the said file (which I can verify separately as well). However, ycm isn't picking it. The error log doesn't have anything other than INFO messages. Is there something else to check to see what's going wrong? In fact, I can confirm that the behavior is the same as having a non-existent database folder.

Printing YouCompleteMe debug information...
-- Completion API: 0
-- Client logfile: /tmp/ycm_87yo9ehc.log
-- Server Python interpreter: /usr/bin/python3
-- Server Python version: 3.6.8
-- Server has Clang support compiled in: True
-- Clang version: clang version 10.0.0 (https://github.com/ycm-core/llvm 038587147cf2f97d1c3e677042f69560c65b5bea)
-- Extra configuration file found and loaded
-- Extra configuration path: /home/uday/llvm-project-github/mlir/.ycm_extra_conf.py
-- C-family completer debug information:
--   Clangd running
--   Clangd process ID: 61318
--   Clangd executable: :['/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd', '-header-insertion-decorato
rs=0', '-resource-dir=/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/10.0.0', '-limit-results=500']
--   Clangd logfiles:
--     /tmp/clangd_stderr4jbqa3fg.log
--   Clangd Server State: Initialized
--   Clangd Project Directory: /home/uday/llvm-project-github/mlir
--   Clangd Settings: {}
--   Clangd Compilation Command: False

Ben Jackson

unread,
Aug 13, 2020, 4:03:57 AM8/13/20
to ycm-users
If you're using clangd, you don't need an extra conf file and usually it actually suppresses some functionality. I would recommend removing it and either:

- Use `g:ycm_clangd_args` to add `--compile-commands-dir=<path to where your compile commands are>`, or
- symlink the compile_commands.json to the root of your project (usually easier)

For the actual question, we can't really come up with any theories without seeing your actual .ycm_extra_conf.py file and e.g. which file is problematic.

Ben

Uday Reddy B

unread,
Aug 13, 2020, 4:22:47 AM8/13/20
to Ben Jackson, ycm-users
On Thu, Aug 13, 2020 at 1:33 PM Ben Jackson <puremo...@gmail.com> wrote:
If you're using clangd, you don't need an extra conf file and usually it actually suppresses some functionality. I would recommend removing it and either:

- Use `g:ycm_clangd_args` to add `--compile-commands-dir=<path to where your compile commands are>`, or
- symlink the compile_commands.json to the root of your project (usually easier)

Thank you, but I use clangd for multiple projects and a single configuration in .vimrc won't work. But the second option you suggest would be good. But with this second option, I have issues with getting clangd started. Even after restarting the server, it yields:

--------------------------------
2020-08-13 13:40:34,150 - INFO - Clangd started
2020-08-13 13:40:34,154 - INFO - Language server requires sync type of Incremental
2020-08-13 13:40:34,154 - INFO - cfamily: Using characters for signature triggers: (,,
2020-08-13 13:40:34,218 - INFO - Received filetype completion available request
2020-08-13 13:40:36,104 - ERROR - The language server communication channel closed unexpectedly. Issue a RestartServer command to recover.
Traceback (most recent call last):
  File "/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/language_server/language_server_completer.py", line 347, in run
    self._ReadMessages()
  File "/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/language_server/language_server_completer.py", line 466, in _ReadMessages
    data, read_bytes, headers = self._ReadHeaders( data )
  File "/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/language_server/language_server_completer.py", line 530, in _ReadHeaders
    data = self.ReadData()
  File "/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/language_server/language_server_completer.py", line 709, in ReadData
    raise RuntimeError( "Connection to server died" )
RuntimeError: Connection to server died
2020-08-13 13:40:42,248 - INFO - Received event notification
2020-08-13 13:40:42,249 - INFO - Adding buffer identifiers for file: /home/uday/llvm-project-github/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
2020-08-13 13:40:44,982 - INFO - Received debug info request
2020-08-13 13:41:13,555 - INFO - Received debug info request
-------------------------

 

For the actual question, we can't really come up with any theories without seeing your actual .ycm_extra_conf.py file and e.g. which file is problematic.

Thanks - I actually figured this out. I was using the default .ycm_extra_conf.py from a previous Ycm, and there was the FlagsForFile def that needed to be updated as below. Incidentally, I had contributed a patch to update the default .ycm_extra_conf.py that was committed upstream some time back but I had this old version still for this project - but there wasn't an error that pointed to it. It was a silent incorrect behavior.

def GetCompilationInfoForFile( filename ):  -> def Settings( **kwargs ):

->  filename -> kwargs[ 'filename' ] )

It now works fine with this change, but it'll be good to also figure out why the symlinking to compiler_commands.json from the working dir doesn't help.

Thanks,
- Uday
 
--
You received this message because you are subscribed to the Google Groups "ycm-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ycm-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ycm-users/027736b3-f376-4c7b-b5d2-4364e7a94a2cn%40googlegroups.com.

Ben Jackson

unread,
Aug 13, 2020, 4:24:25 AM8/13/20
to Uday Reddy B, ycm-users
It now works fine with this change, but it'll be good to also figure out why the symlinking to compiler_commands.json from the working dir doesn't help.

Need to see the clangd log to see why it is failing to start. You can get is from YcmToggleLogs

Uday Reddy B

unread,
Aug 13, 2020, 5:17:50 AM8/13/20
to Ben Jackson, ycm-users
On Thu, Aug 13, 2020 at 1:54 PM Ben Jackson <puremo...@gmail.com> wrote:
It now works fine with this change, but it'll be good to also figure out why the symlinking to compiler_commands.json from the working dir doesn't help.

Need to see the clangd log to see why it is failing to start. You can get is from YcmToggleLogs

This is what the error log says:

2020-08-13 14:45:06,936 - INFO - Received ready request
2020-08-13 14:45:06,943 - INFO - Received event notification
2020-08-13 14:45:06,946 - INFO - Received event notification
2020-08-13 14:45:06,947 - INFO - Adding buffer identifiers for file: /home/uday/llvm-project-github/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
2020-08-13 14:45:06,976 - INFO - Clangd executable found at /home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin and up to date
2020-08-13 14:45:06,976 - INFO - Using Clangd from /home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd
2020-08-13 14:45:06,976 - INFO - Computed Clangd command: ['/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd', '-header-insertion-decorators=0', '-resource-dir=/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/10.0.0', '-limit-results=500']
2020-08-13 14:45:06,977 - INFO - Returning cached Clangd command: ['/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd', '-header-insertion-decorators=0', '-resource-dir=/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/10.0.0', '-limit-results=500']
2020-08-13 14:45:06,978 - INFO - Starting Clangd: ['/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd', '-header-insertion-decorators=0', '-resource-dir=/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/10.0.0', '-limit-results=500']
2020-08-13 14:45:06,986 - INFO - Clangd started
2020-08-13 14:45:06,992 - INFO - Language server requires sync type of Incremental
2020-08-13 14:45:06,992 - INFO - cfamily: Using characters for signature triggers: (,,
2020-08-13 14:45:07,047 - INFO - Received filetype completion available request
2020-08-13 14:45:09,116 - ERROR - The language server communication channel closed unexpectedly. Issue a RestartServer command to recover.

Traceback (most recent call last):
  File "/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/language_server/language_server_completer.py", line 347, in run
    self._ReadMessages()
  File "/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/language_server/language_server_completer.py", line 466, in _ReadMessages
    data, read_bytes, headers = self._ReadHeaders( data )
  File "/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/language_server/language_server_completer.py", line 530, in _ReadHeaders
    data = self.ReadData()
  File "/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/completers/language_server/language_server_completer.py", line 709, in ReadData
    raise RuntimeError( "Connection to server died" )
RuntimeError: Connection to server died
2020-08-13 14:45:11,412 - INFO - Received debug info request
2020-08-13 14:45:16,473 - INFO - Received debug info request
2020-08-13 14:45:32,402 - INFO - Received debug info request
2020-08-13 14:45:36,950 - INFO - Received debug info request
2020-08-13 14:46:23,630 - INFO - Received debug info request


- Uday

Ben Jackson

unread,
Aug 13, 2020, 5:19:26 AM8/13/20
to Uday Reddy B, ycm-users
that’s not the clangd log, it’s the ycmd log.

Uday Reddy B

unread,
Aug 13, 2020, 5:25:28 AM8/13/20
to Ben Jackson, ycm-users
On Thu, Aug 13, 2020 at 2:49 PM Ben Jackson <puremo...@gmail.com> wrote:
that’s not the clangd log, it’s the ycmd log.

Sorry, here it is:

I[14:51:51.116] clangd version 10.0.0 (https://github.com/ycm-core/llvm 038587147cf2f97d1c3e677042f69560c65b5bea)
I[14:51:51.116] PID: 65061
I[14:51:51.116] Working directory: /home/uday/llvm-project-github/mlir
I[14:51:51.116] argv[0]: /home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd
I[14:51:51.116] argv[1]: -header-insertion-decorators=0
I[14:51:51.116] argv[2]: -resource-dir=/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/10.0.0
I[14:51:51.116] argv[3]: -limit-results=500
I[14:51:51.116] Starting LSP over stdin/stdout
I[14:51:51.116] <-- initialize(1)
I[14:51:51.117] --> reply:initialize(1) 1 ms
I[14:51:51.118] <-- initialized
I[14:51:51.118] unhandled notification initialized
I[14:51:51.118] <-- workspace/didChangeConfiguration
I[14:51:51.119] <-- textDocument/didOpen
I[14:51:51.147] Enqueueing 368 commands for indexing
I[14:51:51.147] Updating file /home/uday/llvm-project-github/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp with command
[/home/uday/llvm-project-github/build.release]
/usr/lib64/ccache/clang++ --driver-mode=g++ -DGTEST_HAS_RTTI=0 -DMLIR_CUDA_CONVERSIONS_ENABLED=0 -DMLIR_ROCM_CONVERSIONS_ENABLED=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/mlir/lib/Conversion/StandardToLLVM -I/home/uday/llvm-project-github/mlir/lib/Conversion/StandardToLLVM -Iinclude -I/home/uday/llvm-project-github/llvm/include -I/home/uday/llvm-project-github/mlir/include -Itools/mlir/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -ffunction-sections -fdata-sections -Werror=global-constructors -O3 -fno-exceptions -fno-rtti -UNDEBUG -std=c++14 -o tools/mlir/lib/Conversion/StandardToLLVM/CMakeFiles/obj.MLIRStandardToLLVM.dir/StandardToLLVM.cpp.o -c /home/uday/llvm-project-github/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp -fsyntax-only -resource-dir=/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clang/lib/clang/10.0.0
I[14:51:52.635] Indexed /home/uday/llvm-project-github/mlir/lib/Dialect/SDBM/SDBM.cpp (12627 symbols, 36933 refs, 278 files)
 #0 0x000000000053e0da llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x53e0da)
 #1 0x000000000053be1c llvm::sys::RunSignalHandlers() (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x53be1c)
 #2 0x000000000053bf83 SignalHandler(int) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x53bf83)
 #3 0x00007f53f7e1add0 __restore_rt (/lib64/libpthread.so.0+0x12dd0)
 #4 0x0000000001711fdc (anonymous namespace)::UnnamedLocalNoLinkageFinder::VisitNestedNameSpecifier(clang::NestedNameSpecifier*) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x1711fdc)
 #5 0x0000000001717adf clang::Sema::CheckTemplateArgument(clang::TemplateTypeParmDecl*, clang::TypeSourceInfo*) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x1717adf)
 #6 0x0000000001718070 clang::Sema::ActOnTypeParameter(clang::Scope*, bool, clang::SourceLocation, clang::SourceLocation, clang::IdentifierInfo*, clang::SourceLocation, unsigned int, unsigned int, clang::SourceLocation, clang::OpaquePtr<clang::QualType>, bool) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x1718070)
 #7 0x000000000116aaee clang::Parser::ParseTypeParameter(unsigned int, unsigned int) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x116aaee)
 #8 0x000000000116f090 clang::Parser::ParseTemplateParameter(unsigned int, unsigned int) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x116f090)
 #9 0x000000000116fed1 clang::Parser::ParseTemplateParameterList(unsigned int, llvm::SmallVectorImpl<clang::NamedDecl*>&) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x116fed1)
#10 0x00000000011700d5 clang::Parser::ParseTemplateParameters(unsigned int, llvm::SmallVectorImpl<clang::NamedDecl*>&, clang::SourceLocation&, clang::SourceLocation&) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x11700d5)
#11 0x0000000001172e2f clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x1172e2f)
#12 0x00000000010ff18f clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject*) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x10ff18f)
#13 0x00000000010ffddf clang::Parser::ParseCXXClassMemberDeclarationWithPragmas(clang::AccessSpecifier&, clang::Parser::ParsedAttributesWithRange&, clang::TypeSpecifierType, clang::Decl*) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x10ffddf)
#14 0x0000000001100651 clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int, clang::Decl*) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x1100651)
#15 0x0000000001102aa2 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::Parser::ParsedAttributesWithRange&) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x1102aa2)
#16 0x00000000010e5091 clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x10e5091)
#17 0x00000000010c0d56 clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x10c0d56)
#18 0x00000000010c1641 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.212.constprop.216) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x10c1641)
#19 0x00000000010c167f clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x10c167f)
#20 0x00000000010c7b60 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x10c7b60)
#21 0x00000000010f9e33 clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x10f9e33)
#22 0x00000000010fa6d0 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x10fa6d0)
#23 0x00000000010e9700 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, clang::SourceLocation*) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x10e9700)
#24 0x00000000010c7b86 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x10c7b86)
#25 0x00000000010c85c0 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x10c85c0)
#26 0x00000000010bcced clang::ParseAST(clang::Sema&, bool, bool) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x10bcced)
#27 0x0000000000f3cb31 clang::FrontendAction::Execute() (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0xf3cb31)
#28 0x0000000000a94191 clang::clangd::BackgroundIndex::index(clang::tooling::CompileCommand) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0xa94191)
#29 0x0000000000a94af8 std::_Function_handler<void (), clang::clangd::BackgroundIndex::indexFileTask(clang::tooling::CompileCommand)::'lambda'()>::_M_invoke(std::_Any_data const&) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0xa94af8)
#30 0x0000000000a9c18e clang::clangd::BackgroundQueue::work(std::function<void ()>) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0xa9c18e)
#31 0x0000000000a8d227 void llvm::unique_function<void ()>::CallImpl<clang::clangd::BackgroundIndex::BackgroundIndex(clang::clangd::Context, clang::clangd::FileSystemProvider const&, clang::clangd::GlobalCompilationDatabase const&, llvm::unique_function<clang::clangd::BackgroundIndexStorage* (llvm::StringRef)>, unsigned long)::'lambda0'()>(void*) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0xa8d227)
#32 0x0000000000a6713d std::thread::_Impl<std::_Bind_simple<clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::'lambda0'(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, llvm::unique_function<void ()>, llvm::detail::scope_exit<clang::clangd::AsyncTaskRunner::runAsync(llvm:


I'm not sure why the backtrace is trimmed at #32.

- Uday

Ben Jackson

unread,
Aug 13, 2020, 6:04:30 AM8/13/20
to Uday Reddy B, ycm-users
Try rm -rf .clangd then restart Vim

That fixes about 99% of index crashes 

Uday Reddy B

unread,
Aug 13, 2020, 6:16:57 AM8/13/20
to Ben Jackson, ycm-users
On Thu, Aug 13, 2020 at 3:34 PM Ben Jackson <puremo...@gmail.com> wrote:
Try rm -rf .clangd then restart Vim

I did this and restarted vim, but have the same issue. Restarted ycm server as well, but the issue persists. The logs show a similar stack trace but on a different file. Not sure why this doesn't happen with the .ycm_extra_conf.py approach (I'm using the default configuration that ships with ycm except that I'm setting the compilation database folder).

I[15:44:14.922] Indexed /home/uday/llvm-project-github/mlir/lib/EDSC/CoreAPIs.cpp (16667 symbols, 47667 refs, 328 files)
I[15:44:14.950] Indexed /home/uday/llvm-project-github/mlir/test/lib/IR/TestSideEffects.cpp (25112 symbols, 73177 refs, 384 files)

 #0 0x000000000053e0da llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x53e0da)
 #1 0x000000000053be1c llvm::sys::RunSignalHandlers() (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x53be1c)
 #2 0x000000000053bf83 SignalHandler(int) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x53bf83)
 #3 0x00007f6069d0fdd0 __restore_rt (/lib64/libpthread.so.0+0x12dd0)

 #4 0x0000000001711fdc (anonymous namespace)::UnnamedLocalNoLinkageFinder::VisitNestedNameSpecifier(clang::NestedNameSpecifier*) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x1711fdc)
 #5 0x0000000001717adf clang::Sema::CheckTemplateArgument(clang::TemplateTypeParmDecl*, clang::TypeSourceInfo*) (/home/uday/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clangd/output/bin/clangd+0x1717adf)
 #6 0x0000000001718070 clang::Sema::ActOnTypeParameter(clang::Scope*, bool, clang::SourceLocation, clang::SourceLocation, clang::IdentifierInfo*, clang::SourceLocation, unsigned int, unsigned int, clang::SourceLocatio

...

Ben Jackson

unread,
Aug 13, 2020, 6:48:47 AM8/13/20
to Uday Reddy B, ycm-users
Oh dear. I guess you’d need to report this to clangd devs as clangd is crashing while trying to index your project.
You could also try the latest snapshot build from https://github.com/clangd/clangd (set g:ycm_clangd_binary_path to point at it)

Uday Reddy B

unread,
Aug 13, 2020, 7:45:08 AM8/13/20
to Ben Jackson, ycm-users
On Thu, Aug 13, 2020 at 4:18 PM Ben Jackson <puremo...@gmail.com> wrote:
Oh dear. I guess you’d need to report this to clangd devs as clangd is crashing while trying to index your project.
You could also try the latest snapshot build from https://github.com/clangd/clangd (set g:ycm_clangd_binary_path to point at it)

Thanks, I'll do that. But why does it when using the ycm extra conf?  
It turns out the project it is indexing is the thing clangd itself depends on - LLVM (one of its in-tree sub-projects). 

Ben Jackson

unread,
Aug 13, 2020, 8:12:23 AM8/13/20
to Uday Reddy B, ycm-users
But why does it when using the ycm extra conf?  

Becuase clangd never sees your compile db, so this stops it from doing a full background index

Uday Reddy B

unread,
Aug 13, 2020, 8:27:13 AM8/13/20
to Ben Jackson, ycm-users
On Thu, Aug 13, 2020 at 5:14 PM Uday Reddy B <uday...@gmail.com> wrote:


On Thu, Aug 13, 2020 at 4:18 PM Ben Jackson <puremo...@gmail.com> wrote:
Oh dear. I guess you’d need to report this to clangd devs as clangd is crashing while trying to index your project.
You could also try the latest snapshot build from https://github.com/clangd/clangd (set g:ycm_clangd_binary_path to point at it)

Thanks - it now works with the trunk version of clangd. It is indexing everything.

- Uday

Uday Reddy B

unread,
Aug 22, 2020, 1:38:50 AM8/22/20
to Ben Jackson, ycm-users
On Thu, Aug 13, 2020 at 5:42 PM Ben Jackson <puremo...@gmail.com> wrote:
But why does it when using the ycm extra conf?  

Becuase clangd never sees your compile db, so this stops it from doing a full background index

Thanks. I now realize that clangd would have the compiler_commands.json in that dir - I was thinking that ycm was somehow providing the compiler_commands.json it knows about (via its ycm_extra_conf) to clangd.

- Uday
Reply all
Reply to author
Forward
0 new messages