From 0c83a9af849f6e5ad09e5d60ee70917bffbe0022 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 12 Jul 2018 23:12:54 -0700 Subject: [PATCH] Build --- Build.md | 8 ++++---- Debugging.md | 8 +++++--- Getting-started.md | 6 ++++-- Home.md | 4 ++-- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Build.md b/Build.md index b0fc188..68c6a09 100644 --- a/Build.md +++ b/Build.md @@ -4,7 +4,7 @@ * GCC 7 or higher (`optional,string_view` require libstdc++7 or higher) * MSVC 2017 or higher (included with VS2017 Build Tools) -See [[Getting-started]] for simple cmake build instructions. +See [[Getting-started]] for recommended configuration options for common systems. You may append `-G Ninja -DCMAKE_CXX_LINK_FLAGS=-fuse-ld=lld -DCMAKE_CXX_COMPILER=clang++` @@ -17,12 +17,12 @@ are not supported at the moment. * `-DCMAKE_BUILD_TYPE=(Debug|MinSizeRel|Release|RelWithDebInfo)` - Default: Release + Default: Release Set the build type. The most important ones are Debug and Release. * `-DSYSTEM_CLANG=(ON|OFF)` - Default: ON + Default: ON Enable `SYSTEM_CLANG` if you want to link ccls against a system/local Clang instead of downloading Clang from releases.llvm.org during the configure process. ``` @@ -33,7 +33,7 @@ are not supported at the moment. * `-DCLANG_USE_BUNDLED_LIBC++=on` `clang+llvm*` downloaded from releases.llvm.org also provides libc++ libraries. - If your `libstdc++` is too old, you can use `libc++` in the bundled clang+llvm archive: + This can be used on FreeBSD, but probably does not work on Linux due to conflict of libstdc++ (linked by clang+llvm libraries) and libc++. ```zsh # If your clang++ is old, you may rerun this command with clang++ replaced to diff --git a/Debugging.md b/Debugging.md index 9774500..63d1f8b 100644 --- a/Debugging.md +++ b/Debugging.md @@ -4,15 +4,17 @@ First of all, use a Debug [[Build]]. It is compiled with `-O0 -g` while the defa `--log-file=/tmp/cc.log` -### Dump LSP requests/responses +### stderr -Alternatively, enable logs and pass the `--log-all-to-stderr` option to the ccls executable (`bin/ccls --log-file=/tmp/cc.log --log-all-to-stderr`). You can find stderr output in: +You can find stderr output in: * LanguageClient-neovim: `/tmp/LanguageServer.log` (default) * Emacs lsp-mode: `*lsp-ccls stderr*` buffer. They will also go to `*message*` buffer if `(setq lsp-print-io t)` * VSCode: TODO -You can also use sysdig on Linux: +### Dump LSP requests/responses + +Use sysdig on Linux: ```zsh sudo sysdig -As999 --unbuffered -p '%evt.type %proc.name %evt.buffer' "proc.exe contains ccls and fd.type=pipe" | egrep -v '^Content|^$' ``` diff --git a/Getting-started.md b/Getting-started.md index 236694c..55457a0 100644 --- a/Getting-started.md +++ b/Getting-started.md @@ -23,8 +23,10 @@ The executable is at `release/ccls`. Additional notes: If your `libstdc++` is too old (no C++17 header files) or have an old GCC/Clang, you may use the `-DCLANG_USE_BUNDLED_LIBC++=on` command at [[Build]]. -* FreeBSD 11, Linux with `clang+llvm<6`: `cmake -H. -Brelease -DCLANG_USE_BUNDLED_LIBC++=on` -* FreeBSD 12, Linux with newer libstdc++/clang/llvm (e.g. Arch Linux): `cmake -H. -Brelease -DSYSTEM_CLANG=on -DUSE_SHARED_LLVM=on` +* Arch Linux: `cmake -H. -Brelease -DUSE_SHARED_LLVM=on`. `-DUSE_SHARED_LLVM=on` (optional) makes linked executable smaller. + [aur/ccls-git](https://aur.archlinux.org/packages/ccls-git) currently does not work as it links against `extra/clang=6.0.1-1` which has a [known issue](https://github.com/MaskRay/ccls/issues/30). +* FreeBSD 11: `cmake -H. -Brelease -DCLANG_USE_BUNDLED_LIBC++=on` +* FreeBSD 12, Linux with newer libstdc++ and clang>=6: `cmake -H. -Brelease -DSYSTEM_CLANG=on -DUSE_SHARED_LLVM=on` * Linux with `gcc < 7` but `clang >= 5`, `cmake -H. -Brelease -DCMAKE_CXX_COMPILER=clang++` ### Setup your editor diff --git a/Home.md b/Home.md index 8ecb08c..af1358e 100644 --- a/Home.md +++ b/Home.md @@ -10,10 +10,10 @@ To tell ccls how to find the source tree in your project, you may create either ## Editor configuration -You need to set up a language client for your editor to use definition/reference/hover/... and for some advanced cquery features some extension is needed. +You need to set up a language client for your editor to use definition/reference/hover/... and for some advanced ccls features some extension is needed. ## [[Initialization options]] Customization of ccls, e.g. indexing comments, using msgpack for cache files. -Some tips for [[Debugging]] \ No newline at end of file +Some tips for [[Debugging]]