diff --git a/Build.md b/Build.md index 0f43383..af5f6b0 100644 --- a/Build.md +++ b/Build.md @@ -24,14 +24,6 @@ cmake -H. -BRelease -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/path/to/clan cmake --build Release ``` -For mac users with brew -``` -brew info llvm -cmake -H. -BRelease -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/local/Cellar/llvm//lib/cmake -cmake --build Release -``` -[source](https://github.com/EOSIO/eos/issues/43) - As of 2020-06-23 no pre-built binaries exist for Ubuntu 20.04. `sudo apt-get install clang` and all the other dependencies listed here **excluding** rapidjson-dev (it is vendored in this repo), then run ```sh cmake -H. -BRelease -DCMAKE_BUILD_TYPE=Release \ @@ -229,7 +221,7 @@ Then installing `libncurses5` with `sudo apt install libncurses5` can fix the pr Older versions (6.x) use an older GNU libc which requires `-DCMAKE_CXX_FLAGS=-D__STDC_FORMAT_MACROS` -### MacOS +### macOS To install ccls with Homebrew: ```sh @@ -237,25 +229,26 @@ brew update brew install ccls ``` -To build from source you need MacOS 10.12 (Sierra) or higher to get a version -of Xcode with a sufficiently-new Clang. - -To build using MacPorts Clang add CMake flags -```sh --DCMAKE_CXX_COMPILER=clang++-mp-6.0 --DCMAKE_PREFIX_PATH=/opt/local/libexec/llvm-6.0 -``` - -See https://github.com/MaskRay/ccls/issues/512 , use a [shell script wrapper](Install#shell-script-wrapper): - +Homebrew clang is a bit different from `/usr/bin/clang`. +Invoke `clang++ -xc++ -fsyntax-only -v /dev/null` to get a list of C/C++ search paths. +Add them as `-isystem` into the [shell script wrapper](Install#shell-script-wrapper). For example: ```sh #!/bin/sh -exec /path/to/ccls/Release/ccls -init='{"clang":{"extraArgs":["-isystem", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include"]}}' "$@" +exec /opt/homebrew/bin/ccls --init='{"clang":{"extraArgs":[ + "-isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1", + "-isystem/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.5/include", + "-isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include", + "-isystem/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include", + "-isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks" +]}}' "$@" ``` -With clang < 8, `"-isystem", "/Library/Developer/CommandLineTools/usr/include/c++/v1"` is also needed (https://github.com/MaskRay/ccls/issues/191#issuecomment-453809905) - -With most recent MacOSs(e.g. Catalina 10.15.2), one more clang.extraArgs is needed to make ccls work properly (https://github.com/MaskRay/ccls/issues/512#issuecomment-545575369) +To build from source: +```sh +brew info llvm +cmake -H. -BRelease -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/local/Cellar/llvm//lib/cmake +cmake --build Release +``` ### FreeBSD