-
Notifications
You must be signed in to change notification settings - Fork 99
Mac OS X issues and workaround
I had difficulties getting the irony-mode server to install (LibClang couldn't be found), and found that running brew install llvm
(this can take a very long time to execute) and then inserting -DCMAKE_PREFIX_PATH=/usr/local/opt/llvm
as the first argument of the first cmake
command that appears in the Emacs minibuffer after executing M-x irony-install-server
worked.
Change the 3.5.0 version with the latest (the greatest!).
- Download clang+llvm-3.5.0-macosx-apple-darwin.tar.xz from http://llvm.org/releases/download.html
- Extract it somewhere (e.g:
/tmp
) - make a clean build directory
- run
cmake -DCMAKE_PREFIX_PATH=/tmp/clang+llvm-3.5.0-macosx-apple-darwin/ -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON \</path/to/irony-mode/server/\>
- build and run
make && ./bin/irony-server --version
irony-server compiles and works on OSX Yosemite with standard libclang from Xcode7. The only piece missing is clang-c header files, which may be borrowed from llvm 3.8.
Quick and dirty way to build irony-server on Yosemite with Xcode7
### create /usr/local if not there yet
sudo mkdir -p /usr/local/lib /usr/local/include
### grab standard libclang
sudo cp -p "`xcode-select --print-path`"/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib /usr/local/lib
### (dirty part) supplement with latest llvm clang-c includes
cd /tmp
svn export http://llvm.org/svn/llvm-project/cfe/trunk/include/clang-c/
sudo cp -RP clang-c /usr/local/include
M-x irony-install-server RET
should give you no trouble after that. Compiles and works.
One more step required on OSX - need to find where Xcode keeps all header files to add them to your .clang_complete
. Otherwise irony is useless.
Peek at what Apple compiler uses
echo | clang -x c++ -v -E - 2>&1 | sed -n '/^#include </,/^End/s|^[^/]*\([^ ]*/include[^ ]*\).*$|-I\1|p'
Add them to your .clang_complete
:
$ cat .clang_complete
-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1
-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/include
-I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include
...
Adding to irony-additional-clang-options
should work as well
Source:
It looks like the LLVM package from Homebrew may be broken as found by issue #135.
The error appears as follow:
CMake Warning at cmake/CheckLibClangBuiltinHeadersDir.cmake:87 (message):
CheckLibClangBuiltinHeadersDir: unsupported configuration, please report.
Check with args: -isystem;"/usr/local/Cellar/llvm/3.5.0/lib/clang/3.5.0/include";/Users/Chester/.emacs.d/irony/build/CMakeFiles/CMakeTmp/check-libclang-stddef.cpp
Check output:
dyld: Library not loaded: @rpath/libLLVM-3.5.dylib
Referenced from: /usr/local/opt/llvm/lib/libclang.dylib
Reason: image not found
SIGTRAP
The fix found in this issue is to do:
$ cd /usr/local/opt/llvm/lib
$ sudo install_name_tool -change @rpath/libLLVM-3.5.dylib /usr/local/opt/llvm/lib/libLLVM-3.5.dylib /usr/local/opt/llvm/lib/libclang.dylib
Please refer to this page the Homebrew issue #34169 to track this problem.