Comments (2)
2019-07-06-001628_448x629_scrot
2019-07-06-001638_388x112_scrot
Please paste text, not images.
mkdir build && cd build && cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=YES .. && ln -s compile_commands.json
Tip:
cmake -H. -Bbuild -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
to avoid cd
Here are some things you should try before filing a bug report:
- For client issues related to emacs-ccls or vscode-ccls, report in their own repository.
- For build problems, check https://github.com/MaskRay/ccls/wiki/Build
- Check https://github.com/MaskRay/ccls/wiki/Debugging
- Check the FAQ to see if your issue is mentioned.
If none of those help, remove this section and fill out the four sections in the template below.
Observed behavior
Describe what happened. Any aids you can include (that you think could be relevant) are a tremendous help.
compile_commands.json
or.ccls
(wiki/Project-Setup)- Reduce to A minimal set of
.c
.cc
.h
.hh
files that can still demonstrate the issue. - Consider a screencast gif.
Expected behavior
Describe what you expected to happen.
Steps to reproduce
- Select these example steps,
- Delete them,
- And replace them with precise steps to reproduce your issue.
System information
- ccls version (
git describe --tags --long
): - clang version:
- OS:
- Editor:
- Language client (and version):
from emacs-ccls.
I've met the exact same phenomenon, and I solved it by adjusting the compiler flags.
TL;DR, I find the lsp server will work as long as the project can be built with clang(note: working with gcc does not state that the project will work with clang).
long long story below
I record my experience here in case people may meet the same problem. Note, I'm new to c++ and c++ build system.
My System Environment
I have a system(centos 7.6), which installed devtoolset-7(gcc 7).
I also compile and install clang 11 by myself.
My Project Info
I try to use ccls on https://github.com/tikv/titan project.
After I run
cmake -H. -Bbuild -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
ln -sf build/compile_commands.json .
I can see the compiler_commands.json, and the first several lines looks like this
โ ~/p/titan ๎ master* > head -6 compile_commands.json
[
{
"directory": "/root/xxx/titan/build",
"command": "/opt/rh/devtoolset-7/root/usr/bin/c++ .............. -W -Wextra -Wall -Wsign-compare -Wshadow -Wno-unused-parameter -Wno-unused-variable -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers -Wno-strict-aliasing -std=c++11 -fno-omit-frame-pointer -momit-leaf-frame-pointer -march=native -Werror -fno-builtin-memcmp -o CMakeFiles/titan_blob_file_iterator_test.dir/src/blob_file_iterator_test.cc.o -c /root/xxx/titan/src/blob_file_iterator_test.cc",
"file": "/root/xxx/titan/src/blob_file_iterator_test.cc"
},
And I try to start my Emacs and open the project, but it does not work, and the lsp server(ccls) always responds with not indexed
. And if I remove the compiler_commands.json, it works partially(some header file can't be found by lsp server).
I'm pretty sure that there are some problems in my json file, however, I do not know where the problem is (I think the root cause is that I do not know the working mechanism of ccls and I have little knowledge about c++).
After long time searching, I decide to try clangd
to see if it can work properly, but of course, it failed. And the error message I found from the clangd:: stderr
is Couldn't build compiler instance
.
I search the error message in clangd source code and I found the reason this happens is that the compiler should be clang instead of gcc. So I disable my gcc and try to re-build my project with clang, to my surprise, the build-process failed. After some investigation, I adjust some compile flags and the project can be built with clang.
cmake -H. -Bbuild -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DPORTABLE=1
After that, the lsp server also works ๐.
I change the lsp server from clangd to ccls, and it also works well.
from emacs-ccls.
Related Issues (20)
- c++17, std::optional HOT 1
- Header files not found with emacs-ccls, but works fine at vscode. HOT 1
- imenu: show static member variable instead of function
- Help wanted with configuration: C++ headers not found HOT 1
- conditional highlights doesn't work HOT 2
- Is there a way to manually suspend/resume ccls indexing?
- ccls stuck in "starting"
- Cannot find the references via ccls.xref HOT 2
- Open all hierachy tree at once
- Customize initialization options in S-exp has no effect HOT 1
- Multi-root project setup HOT 2
- Compilation warnings (as of 29.3)
- Using function prototypes auto-completion has strange behavior
- (void-function lsp:ccls-semantic-highlight-symbol-ranges). HOT 11
- use eval-and-compile instead of eval-when-compile HOT 1
- Function definition lsp:ccls-call-children is void HOT 3
- imenu not showing symbol types HOT 3
- Help with .ccls file config: Header file correctly parsed but "file not found" error appears.
- can not jump to std definition
- How to prevent buffers *ccls-tree call/inheritance hierarchy to use same window than buffer Treemacs ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emacs-ccls.