Andersbakken / rtags

A client/server indexer for c/c++/objc[++] with integration for Emacs based on clang.
http://www.rtags.net
GNU General Public License v3.0
1.83k stars 254 forks source link

How I can use rtags in TRAMP mode? #1206

Open MaksVal opened 6 years ago

MaksVal commented 6 years ago

Hi! Thank for your work. How Can I do it? I can't install rtags on a remote machine.

Andersbakken commented 6 years ago

I honestly have never done it myself but there was a significant contribution made by some users a couple of years ago. There's some info in this issue:

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

vibrys commented 6 years ago

as time of implementing this extension I left documentation. Please refer to it. For some time I don't need the remote work, thus I'm not up to date with current status. The basic idea is to have binary part of rtags (rdm and rc) on remote server (Yes, You have to compile and install it there) and elisp part on Your local machine.

https://github.com/Andersbakken/rtags/pull/546

mycpuorg commented 4 years ago

Failure to run rtags on remote files

I am happy customer of rtags on local machine. However, when I try to use it on my remote code base I run into issues. Here's my .emacs configs and errors.

Emacs: 26.3

[home]$ rc --version
2.37.130
[home]$ rdm --version
2.37.130
(setq rtags-autostart-diagnostics t)
(setq rtags-tramp-enabled t)

;;;; Is this similar to setting $PATH env var, but for TRAMP
;;;; the below path has rc, rdm, and rp in it
(add-to-list 'tramp-remote-path "/MY/REMOTE/PATH/rtags/bin")

;;;; This is the same as --socket-address to rc
;;;; rdm --rcp-port <REMOTE_PORT_RDM>
(setq rtags-socket-address "my-remote-machine:REMOTE_PORT_RDM")

;;;; Gives you an unfair advantage
(setq rtags-rc-log-enabled t)

Trying to open a file on my-remote-machine throws up the following errors:

Tramp: Opening connection for my-remote-machine using sshx...
Tramp: Sending command ‘exec ssh -q   -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none -t -t my-remote-machine /bin/sh’
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on ‘my-remote-machine’
Tramp: Opening connection for my-remote-machine using sshx...done
cmake-ide [Thu Jan 16 13:54:28 2020]: Starting rdm server
File mode specification error: (file-missing Searching for program No such file or directory rdm)
cmake-ide [Thu Jan 16 13:54:28 2020]: Starting rdm server
apply: Searching for program: No such file or directory, rdm
****** Got Diagnostics Error ******
rtags process (rdm) stopped...

It is a big plus for me to get it working (and a lot of others) since I work on remote codebase a lot. I'd be happy to help if you folks have a direction. Thanks.

vibrys commented 4 years ago

in case of "remote mode" for rtags, I run rdm on remote machine by hand, but on the other hand I don't see reason why cmake-ide wouldn't manage. I'm not using cmake-ide, but I'd start with verifying if any program residing on Your remote location "/MY/REMOTE/PATH/rtags/bin", can be called by emacs, ie what happens if You do the following?:

  1. visit some file on Your remote machine
  2. M-x shell-command: rc --help
mycpuorg commented 4 years ago

@vibrys Sorry about the delay. If the objective is to figure out that the remote location's rtags program can be triggered by Emacs - it failed.

Here are the steps:

FileSystemWatcher::watch() '/tmp/cmakeMqZWRU/compile_commands.json' doesn't seem to be watchable
FileSystemWatcher::watch() '/tmp/cmakelkQV72/compile_commands.json' doesn't seem to be watchable
FileSystemWatcher::watch() '/tmp/cmakeBr0aly/compile_commands.json' doesn't seem to be watchable

Thoughts?

vibrys commented 4 years ago

what is the result of M-x describe-variable: tramp-remote-path ?

mycpuorg commented 4 years ago

Here's the full output:

tramp-remote-path’s value is
("/home/ubuntu/.emacs.d/rtags/bin/" tramp-default-remote-path "/bin" "/usr/bin" "/sbin" "/usr/sbin" "/usr/local/bin" "/usr/local/sbin" "/local/bin" "/local/freeware/bin" "/local/gnu/bin" "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin" "/opt/bin" "/opt/sbin" "/opt/local/bin")
Original value was 
(tramp-default-remote-path "/bin" "/usr/bin" "/sbin" "/usr/sbin" "/usr/local/bin" "/usr/local/sbin" "/local/bin" "/local/freeware/bin" "/local/gnu/bin" "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin" "/opt/bin" "/opt/sbin" "/opt/local/bin")

Documentation:
List of directories to search for executables on remote host.
For every remote host, this variable will be set buffer local,
keeping the list of existing directories on that host.

You can use ‘~’ in this list, but when searching for a shell which groks
tilde expansion, all directory names starting with ‘~’ will be ignored.

‘Default Directories’ represent the list of directories given by
the command "getconf PATH".  It is recommended to use this
entry on head of this list, because these are the default
directories for POSIX compatible commands.  On remote hosts which
do not offer the getconf command (like cygwin), the value
"/bin:/usr/bin" is used instead.  This entry is represented in
the list by the special value ‘tramp-default-remote-path’.

‘Private Directories’ are the settings of the $PATH environment,
as given in your ‘~/.profile’.  This entry is represented in
the list by the special value ‘tramp-own-remote-path’.

You can customize this variable.
vibrys commented 4 years ago

Two things:

  1. visit some file on remote machine, then tell what is the output of: M-x shell-command: rc --help?

  2. Cannot help with cmake-ide. Just check if rtags+tramp works without it.

On March 2, 2020 9:15:14 PM GMT+01:00, mycpuorg notifications@github.com wrote:

Here's the full output:>


tramp-remote-path’s value is>
("/home/ubuntu/.emacs.d/rtags/bin/" tramp-default-remote-path "/bin"
"/usr/bin" "/sbin" "/usr/sbin" "/usr/local/bin" "/usr/local/sbin"
"/local/bin" "/local/freeware/bin" "/local/gnu/bin" "/usr/freeware/bin"
"/usr/pkg/bin" "/usr/contrib/bin" "/opt/bin" "/opt/sbin"
"/opt/local/bin")>
Original value was >
(tramp-default-remote-path "/bin" "/usr/bin" "/sbin" "/usr/sbin"
"/usr/local/bin" "/usr/local/sbin" "/local/bin" "/local/freeware/bin"
"/local/gnu/bin" "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin"
"/opt/bin" "/opt/sbin" "/opt/local/bin")>

Documentation:>
List of directories to search for executables on remote host.>
For every remote host, this variable will be set buffer local,>
keeping the list of existing directories on that host.>

You can use ‘~’ in this list, but when searching for a shell which
groks>
tilde expansion, all directory names starting with ‘~’ will be
ignored.>

‘Default Directories’ represent the list of directories given by>
the command "getconf PATH".  It is recommended to use this>
entry on head of this list, because these are the default>
directories for POSIX compatible commands.  On remote hosts which>
do not offer the getconf command (like cygwin), the value>
"/bin:/usr/bin" is used instead.  This entry is represented in>
the list by the special value ‘tramp-default-remote-path’.>

‘Private Directories’ are the settings of the $PATH environment,>
as given in your ‘~/.profile’.  This entry is represented in>
the list by the special value ‘tramp-own-remote-path’.>

You can customize this variable.>
```>

-- >
You are receiving this because you were mentioned.>
Reply to this email directly or view it on GitHub:>
https://github.com/Andersbakken/rtags/issues/1206#issuecomment-593596214