Mac 上的 doom-emacs 不能直接通过 M-x irony-install-server 成功安装 irony-server,需要手工安装,下面把详细步骤纪录下来,以备后来查询。

  1. 下载 llvm 预编译软件包
1
2
cd /tmp
wget http://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-apple-darwin.tar.xz
  1. 解压到临时目录(如/tmp)
1
2
cd /tmp
x clang+llvm-8.0.0-x86_64-apple-darwin.tar.xz
  1. 准备编译环境
1
2
3
4
5
brew install cmake
cd /tmp
git clone https://github.com/Sarcasm/irony-mode irony-mode
mkdir irony-mode/server/build
pushd irony-mode/server/build
  1. 开始编译
1
2
3
4
DEST="$HOME/.emacs.d/.local/etc/irony-server/"
cmake -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON -DCMAKE_INSTALL_PREFIX="$DEST" -DCMAKE_PREFIX_PATH=/tmp/clang+llvm-8.0.0-x86_64-apple-darwin ../
cmake --build . --use-stderr --config Release --target install
install_name_tool -change @rpath/libclang.dylib /usr/local/opt/llvm/lib/libclang.dylib "$DEST/bin/irony-server"
  1. 清理
1
2
3
popd
rm -rf irony-mode
rm -rf clang+llvm-8.0.0-x86_64-apple-darwin