Skip to content
Fangrui Song edited this page Jan 6, 2019 · 6 revisions

Shell script wrapper

If you're using ccls for your own personal use and don't want to bother installing it, you don't have to. Consider putting a small shell script wrapper ccls on your PATH to customize command line options.

#!/bin/sh
exec "$HOME/src/ccls/Release/ccls" "$@"

(be sure to make the script executable!) You might want to

  • add other options such as --log-file=/tmp/ccls.out to force logging. -v=1 and -init= are other useful options. See Customization.
  • set LD_LIBRARY_PATH if CMake fails to set DT_RUNPATH for the built ccls executable.
  • set Debugging environment variables that might be useful.

CMake install

If you'd like to install ccls into a separate location, read on.

The CMake install rule will copy the ccls binary into the install prefix location set via -DCMAKE_INSTALL_PREFIX=<prefix> (default: /usr/local). After building you can run:

cmake --build Release --target install
# cmake --build . --config Release --target install

This will install ccls as <prefix>/bin/ccls (and also install the LLVM shared libraries if -DUSE_SHARED_LLVM=ON).

If you have <prefix>/bin on your PATH then ccls should be found.

Clang resource directory

Some header files such as stddef.h stdint.h are located in the include/ subdirectory of Clang resource directory.

The location of Clang resource directory is hard-coded in the ccls executable (-DDEFAULT_RESOURCE_DIRECTORY= when building ccls). The absence of Clang resource directory may lead to errors like unknown type name 'size_t' and incomplete index results.

If you downloaded Clang+LLVM as part of the build and you want to install ccls and delete the build directory, you need to copy the contents of the resource directory; for example something like:

sudo mkdir -p /usr/local/clang/7.0.0
sudo cp -a Release/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/lib/clang/7.0.0/include /usr/local/clang/7.0.0/

Then you must configure ccls to locate this directory by adding an option such as --init='{"clang": {"resourceDir": "/usr/local/clang/7.0.0"}}' (see clang.resourceDir for more information).

Clone this wiki locally