Better instructions for building on Ubuntu 18.10 with system-installed LLVM 7

uıɐɾ ʞ ʇɐɯɐs 2019-02-08 20:52:47 -08:00 committed by Fangrui Song
parent 1ceb1f1788
commit 517427649f

@ -154,6 +154,34 @@ To build from source you'll need `sudo apt install zlib1g-dev ncurses-dev`
On Ubuntu 16.04 install g++-7 via [these directions](https://gist.github.com/jlblancoc/99521194aba975286c80f93e47966dc5)
#### Ubuntu Cosmic 18.10
ccls 0.20181024.1 and later require LLVM 7, which is available on Ubuntu 18.10.
You can compile ccls against the system-installed LLVM instead needing to download LLVM separately.
Download additional packages:
```shell
sudo apt install -y clang libclang-dev libncurses-dev libtinfo5 llvm-dev
```
which should install their versioned counterparks (e.g. clang-7, libclang-7-dev, etc).
Configure LLVM as so:
```shell
cmake -H. -Bbuild \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=/usr/lib/llvm-7 \
-DLLVM_INCLUDE_DIR=/usr/lib/llvm-7/include \
-DLLVM_BUILD_INCLUDE_DIR=/usr/include/llvm-7/ \
-DLLVM_ENABLE_RTTI=on
```
Notice that `LLVM_INCLUDE_DIR` points to /usr/lib, and `LLVM_BUILD_INCLUDE` points to /usr/include.
Build as normal. You'll have a ccls library that will be compiled against the sytem-installed LLVM, and use the system clang resource directory as well.
### Void Linux
To build **ccls** on Void Linux with system Clang+LLVM: `cmake -H. -BRelease -DLLVM_ENABLE_RTTI=on`