Any guide for using ccls or cquery for Chromium development

627 views
Skip to first unread message

shp...@gmail.com

unread,
Apr 24, 2019, 12:27:26 PM4/24/19
to Chromium-dev
Hi,

Is anyone using ccls or cquery with Emacs for your development or code navigation?

This thread actually talks about using LSP for development, but still I am not able to setup my environment.

I wonder how you guys able to setup (e.g. index) your Emacs for development.

After compiling the chrome with gn gen out/Default, I was able to create compile_commands.json with

ninja -C out/Default -t compdb cxx cc > compile_commands.json; or
tools/clang/script/generate_compdb.py -p out/Release > compile_commands.json

I opened the editor so that ccls can automatically index the project, but it stops at some point and every time I reopen the editor, it seems to starts over indexing the whole project again 

Anyone using ccls or cquery for your development, could you please share your experiments setting up the IDE?

Thanks!
Seonghyun

Nico Weber

unread,
Apr 24, 2019, 12:41:50 PM4/24/19
to shp...@gmail.com, Chromium-dev, Asanka Herath
Sounds like ccls's faq basically says that it doesn't work well with large projects: https://github.com/MaskRay/ccls/wiki/FAQ#full-indexing-takes-a-long-time--crushes-my-system

I think most people use https://cs.chromium.org to navigate the code. Here's an editor integration: https://github.com/chromium/vim-codesearch (might be interesting to try and turn that into an LSP plugin).


There's also https://www.chromium.org/developers/code-browsing-in-chromium , but that looks like it hasn't been updated in a while.


--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/06f35ccf-cf10-4dbc-a36c-1f5aece0b951%40chromium.org.

James Cook

unread,
Apr 24, 2019, 2:15:36 PM4/24/19
to Nico Weber, shp...@gmail.com, Chromium-dev, Asanka Herath

tuank...@gmail.com

unread,
Apr 26, 2019, 7:02:27 AM4/26/19
to Chromium-dev
Hi Seonghyun,

I have been using ccls + Visual Studio Code on a Chromium-based codebase for quite some time. My development enviroment is Windows though, so if you're also using Windows then I might be of help to you.
Anyway since setting up ccls took me like a week of various troubleshooting, I can offer you some general pointers (not OS-dependant):
* Before running emacs, you can try indexing everything by running ccls -index=[folder to chromium] -v=1. This will generate an initial cache, and also prints as much logs as possible that can help you.
* The way ccls indexes a C++ source file is: it takes the corresponsing compilation command in compile_commands.json, then strips out the path to Chromium's clang (at the beginning), then passes all the remaining flags to the clang compiler linked to ccls. As such, there might be flags that works with Chromium's clang but cause errors with ccls' clang. To determine any offending flags, grab a random compilation command, then replace the path to Chromium's clang with the path to ccls' clang. The path to ccls' clang depends on how you build it, if you build ccls with system clang then it's the path to system clang, if you build ccls with a custom built clang then it's the path to the custom built clang. After replacing, try to run the command in a terminal. If it fails then clang will tell you what went wrong and then you can figure out what to do next. Rinse and repeat until clang doesn't complain anymore. Some flags which may cause problems are "-DCR_CLANG_REVISION", "-Xclang" and flags related to precompiled headers.

Hope this can help you. If you still have any problems then it might be wise to post the ccls -index log here so I can take a look.
Reply all
Reply to author
Forward
0 new messages