The irony server provides symbol completion for irony-mode on Emacs. Under the hood, it uses libclang to parse C and C++ source. On Mac OS, the Xcode command line tools comes with clang, but it does not provide the necessary header files. Here are the specific instructions for MacPorts.
$ clang -v Apple clang version 15.0.0 (clang-1500.3.9.4) Target: x86_64-apple-darwin23.5.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin $ sudo port install cmake clang-15 ---> Computing dependencies for cmake ... ---> Cleaning cmake ---> Computing dependencies for clang-15 ... ---> Cleaning clang-15 ---> Scanning binaries for linking errors ---> No broken files found. ---> No broken ports found. $ cmake \ -DLIBCLANG_LIBRARY=/opt/local/libexec/llvm-15/lib/libclang.dylib \ -DLIBCLANG_INCLUDE_DIR=/opt/local/libexec/llvm-15/include \ -DCMAKE_INSTALL_PREFIX=$HOME/.emacs.d/irony/ \ $HOME/.emacs.d/elpa/irony-20190703.1732/server && cmake --build . --use-stderr --config Release --target install
Some notes:
- MacPorts llvm-15 package provides the libclang.dylib, but clang-15 provides the header files for it (see macports #69392).
- LIBCLANG_LIBRARY has to point to the dylib (or the .so on Linux), not the lib/ directory.