MaskRay / ccls

C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting
Apache License 2.0
3.73k stars 254 forks source link

compile ccls against clang12.0.1 #915

Closed cwangbh closed 1 year ago

cwangbh commented 1 year ago

System information

Observed behavior

after building, it cannot link to the proper implementation

[ 86%] Building CXX object CMakeFiles/ccls.dir/src/messages/textDocument_document.cc.o
[ 88%] Building CXX object CMakeFiles/ccls.dir/src/messages/textDocument_hover.cc.o
[ 90%] Building CXX object CMakeFiles/ccls.dir/src/messages/textDocument_references.cc.o
[ 93%] Building CXX object CMakeFiles/ccls.dir/src/messages/textDocument_rename.cc.o
[ 95%] Building CXX object CMakeFiles/ccls.dir/src/messages/textDocument_signatureHelp.cc.o
[ 97%] Building CXX object CMakeFiles/ccls.dir/src/messages/workspace.cc.o
/home/cwang24/MyDocument/software/ccls/src/messages/workspace.cc: In member function ‘void ccls::MessageHandler::workspace_didChangeConfiguration(ccls::EmptyParam&)’:
/home/cwang24/MyDocument/software/ccls/src/messages/workspace.cc:26:24: warning: unused variable ‘_’ [-Wunused-variable]
   for (auto &[folder, _] : g_config->workspaceFolders)
                        ^
[100%] Linking CXX executable ccls
CMakeFiles/ccls.dir/src/clang_tu.cc.o: In function `ccls::buildCompilerInvocation(std::string const&, std::vector<char const*, std::allocator<char const*> >, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>)':
clang_tu.cc:(.text+0x1c70): undefined reference to `clang::driver::Driver::Driver(llvm::StringRef, llvm::StringRef, clang::DiagnosticsEngine&, std::string, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>)'
CMakeFiles/ccls.dir/src/indexer.cc.o: In function `ccls::(anonymous namespace)::IndexFrontendAction::CreateASTConsumer(clang::CompilerInstance&, llvm::StringRef)':
indexer.cc:(.text+0x4b0d): undefined reference to `clang::index::createIndexingASTConsumer(std::shared_ptr<clang::index::IndexDataConsumer>, clang::index::IndexingOptions const&, std::shared_ptr<clang::Preprocessor>)'
indexer.cc:(.text+0x4baf): undefined reference to `clang::MultiplexConsumer::MultiplexConsumer(std::vector<std::unique_ptr<clang::ASTConsumer, std::default_delete<clang::ASTConsumer> >, std::allocator<std::unique_ptr<clang::ASTConsumer, std::default_delete<clang::ASTConsumer> > > >)'
CMakeFiles/ccls.dir/src/indexer.cc.o: In function `ccls::idx::index(ccls::SemaManager*, ccls::WorkingFiles*, ccls::VFS*, std::string const&, std::string const&, std::vector<char const*, std::allocator<char const*> > const&, std::vector<std::pair<std::string, std::string>, std::allocator<std::pair<std::string, std::string> > > const&, bool, bool&)':
indexer.cc:(.text+0x9612): undefined reference to `clang::CompilerInstance::CompilerInstance(std::shared_ptr<clang::PCHContainerOperations>, clang::InMemoryModuleCache*)'
indexer.cc:(.text+0x9653): undefined reference to `clang::CompilerInstance::setInvocation(std::shared_ptr<clang::CompilerInvocation>)'
indexer.cc:(.text+0x969a): undefined reference to `clang::TargetInfo::CreateTargetInfo(clang::DiagnosticsEngine&, std::shared_ptr<clang::TargetOptions> const&)'
CMakeFiles/ccls.dir/src/project.cc.o: In function `ccls::Project::loadDirectory(std::string const&, ccls::Project::Folder&)':
project.cc:(.text+0x2a89): undefined reference to `clang::tooling::CompilationDatabase::loadFromDirectory(llvm::StringRef, std::string&)'
project.cc:(.text+0x34e7): undefined reference to `llvm::sys::ExecuteAndWait(llvm::StringRef, llvm::ArrayRef<llvm::StringRef>, llvm::Optional<llvm::ArrayRef<llvm::StringRef> >, llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, unsigned int, unsigned int, std::string*, bool*, llvm::Optional<llvm::sys::ProcessStatistics>*, llvm::BitVector*)'
CMakeFiles/ccls.dir/src/sema_manager.cc.o: In function `ccls::(anonymous namespace)::buildCompilerInstance(ccls::Session&, std::unique_ptr<clang::CompilerInvocation, std::default_delete<clang::CompilerInvocation> >, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, clang::DiagnosticConsumer&, ccls::PreambleData const*, std::string const&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >&)':
sema_manager.cc:(.text+0x1da4): undefined reference to `clang::CompilerInstance::CompilerInstance(std::shared_ptr<clang::PCHContainerOperations>, clang::InMemoryModuleCache*)'
sema_manager.cc:(.text+0x1e29): undefined reference to `clang::CompilerInstance::setInvocation(std::shared_ptr<clang::CompilerInvocation>)'
sema_manager.cc:(.text+0x1e56): undefined reference to `clang::TargetInfo::CreateTargetInfo(clang::DiagnosticsEngine&, std::shared_ptr<clang::TargetOptions> const&)'
CMakeFiles/ccls.dir/src/sema_manager.cc.o: In function `ccls::(anonymous namespace)::preambleMain(void*)':
sema_manager.cc:(.text+0x61a0): undefined reference to `clang::PrecompiledPreamble::Build(clang::CompilerInvocation const&, llvm::MemoryBuffer const*, clang::PreambleBounds, clang::DiagnosticsEngine&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::shared_ptr<clang::PCHContainerOperations>, bool, clang::PreambleCallbacks&)'
CMakeFiles/ccls.dir/src/messages/textDocument_formatting.cc.o: In function `ccls::(anonymous namespace)::format(ccls::ReplyOnce&, ccls::WorkingFile*, clang::tooling::Range)':
textDocument_formatting.cc:(.text+0x12ff): undefined reference to `clang::tooling::calculateRangesAfterReplacements(clang::tooling::Replacements const&, std::vector<clang::tooling::Range, std::allocator<clang::tooling::Range> > const&)'
CMakeFiles/ccls.dir/src/main.cc.o: In function `llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >::~opt()':
main.cc:(.text._ZN4llvm2cl3optISsLb0ENS0_6parserISsEEED2Ev[_ZN4llvm2cl3optISsLb0ENS0_6parserISsEEED5Ev]+0xe): undefined reference to `vtable for llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >'
CMakeFiles/ccls.dir/src/main.cc.o: In function `main':
main.cc:(.text.startup+0x66): undefined reference to `llvm::cl::SetVersionPrinter(std::function<void (llvm::raw_ostream&)>)'
CMakeFiles/ccls.dir/src/main.cc.o: In function `_GLOBAL__sub_I__ZN4ccls14g_init_optionsE':
main.cc:(.text.startup+0x13e0): undefined reference to `vtable for llvm::cl::OptionValue<std::string>'
main.cc:(.text.startup+0x13eb): undefined reference to `vtable for llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >'
main.cc:(.text.startup+0x13f6): undefined reference to `vtable for llvm::cl::parser<std::string>'
main.cc:(.text.startup+0x15d2): undefined reference to `vtable for llvm::cl::OptionValue<std::string>'
main.cc:(.text.startup+0x15dd): undefined reference to `vtable for llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >'
main.cc:(.text.startup+0x15e8): undefined reference to `vtable for llvm::cl::parser<std::string>'
main.cc:(.text.startup+0x17a3): undefined reference to `vtable for llvm::cl::parser<std::string>'
main.cc:(.text.startup+0x191d): undefined reference to `vtable for llvm::cl::OptionValue<std::string>'
main.cc:(.text.startup+0x1928): undefined reference to `vtable for llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >'
main.cc:(.text.startup+0x1933): undefined reference to `vtable for llvm::cl::parser<std::string>'
CMakeFiles/ccls.dir/src/main.cc.o: In function `llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >::~opt()':
main.cc:(.text._ZN4llvm2cl3optISsLb0ENS0_6parserISsEEED0Ev[_ZN4llvm2cl3optISsLb0ENS0_6parserISsEEED5Ev]+0xe): undefined reference to `vtable for llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >'
collect2: error: ld returned 1 exit status
gmake[2]: *** [ccls] Error 1
gmake[1]: *** [CMakeFiles/ccls.dir/all] Error 2
gmake: *** [all] Error 2
MaskRay commented 1 year ago

Please check that your Clang and LLVM libraries provide needed libLLVM*.a libclang*.a or libLLVM-*.so libclang-cpp.so files.