rtags

rtags
Login

rtags

Install

Ubuntu

https://linuxhint.com/install-llvm-ubuntu/

http://apt.llvm.org/

https://github.com/Andersbakken/rtags/issues/493

git clone https://github.com/Andersbakken/rtags.git
cd rtags
git submodule init
git submodule update
mkdir build
cd build
cmake ..
# IMPORTANT: Clean CMake cache on cmake error!!!
rm CMakeCache.txt # ONLY WITH ERRORS
make
sudo make install

Troubleshooting

Check all prerequisites

https://linuxhint.com/install-llvm-ubuntu/

For example, on Ubuntu 16.04 Xenial, add these commands to software sources, update and install:

    deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main
    deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main
    deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main

    sudo wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -

    sudo apt-get install clang-6.0 lldb-6.0 lld-6.0 libclang-6.0-dev

Special requisite libclang-6.0-dev

This error seems to be quite common, according to forums:

It's likely that the include file <clang-c/Index.h> could not be found!

It is resolved by installing libclang-6.0-dev (see above).

Clean CMake cache on error

    rm CMakeCache.txt

Other dists

Type make in this directory for interactive help.
Check the Makefile for details.

Intro/Read more

https://github.com/Andersbakken/rtags
https://github.com/Andersbakken/rtags/blob/master/README.org
https://vxlabs.com/2016/04/11/step-by-step-guide-to-c-navigation-and-completion-with-emacs-and-the-clang-based-rtags/
https://trivialfis.github.io/emacs/2017/08/02/C-C++-Development-Environment-on-Emacs.html#org97a10f6

Exordium is an "Emacs environment", with rtags included: https://github.com/philippe-grenet/exordium#installation
https://github.com/philippe-grenet/exordium#rtags

Emacs config:

;; rtags installs Emacs package in the path below
;; https://github.com/Andersbakken/rtags
(setq load-path
      (cons "/usr/local/share/emacs/site-lisp/rtags" load-path))
(require 'rtags)
(define-key global-map (kbd "M-.") (function rtags-find-symbol-at-point))
(define-key global-map (kbd "M-,") (function rtags-find-references-at-point))
(define-key global-map (kbd "M-;") (function rtags-find-file))
(define-key global-map (kbd "C-.") (function rtags-find-symbol))
(define-key global-map (kbd "C-,") (function rtags-find-references))
(define-key global-map (kbd "C-<") (function rtags-find-virtuals-at-point))
(define-key global-map (kbd "M-i") (function rtags-imenu))

Makefile rules entry to index files

Check the Makefile in this directory.

CMake project with rtags

Check the build script in the cmake-project directory.