Skip to content
William Boman edited this page Dec 17, 2021 · 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. 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 path is derived from clang -print-resource-dir at CMake configure time.

The location is hard-coded in the ccls executable (-DCLANG_RESOURCE_DIR= when building ccls). If you want to install ccls and delete the build directory, you need to copy the contents of the resource directory before building ccls.

Otherwise the absence of Clang resource directory may lead to errors like unknown type name 'size_t'.

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 set the initialization option clang.resourceDir: --init='{"clang": {"resourceDir": "/usr/local/clang/7.0.0"}}'.

note: It's likely you will encounter this issue whenever you update clang without rebuilding ccls.