Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtags-install fails - cmake: command not found #1386

Closed
sfavazza opened this issue Apr 26, 2020 · 5 comments
Closed

rtags-install fails - cmake: command not found #1386

sfavazza opened this issue Apr 26, 2020 · 5 comments

Comments

@sfavazza
Copy link

Describe the bug
When running the emacs command to install the rtags package I get the error cmake: command not found, even if the CMake tool is correctly installed.

To Reproduce
Steps to reproduce the behavior:

  1. open emacs
  2. M-x load-library RET rtags
  3. M-x rtags-install RET
  4. In the *RTags Install* buffer you should see a line like the following:
    /home/sfavazza/.emacs.d/elpa/rtags-20200221.36//install-rtags.sh: line 21: cmake: command not found
    Failed to cmake

Expected behavior
I would expect the installation going smoothly without any interruptions.

Observations and Workarounds
Despite the confusing error (as CMake is correctly installed on my machine), I realized that the automatically generated *.sh installation script is not marked as executable.
Moreover the attempt to repeat the same script ends up into another error:

curl: (33) HTTP server doesn't seem to support byte ranges. Cannot resume.

This instead is due to the fact that the archive was already downloaded once already.
Normally I would expect that the installation script tries to delete such file before attempting a download.

Based on these observations I managed to find a workaround (I guess it can be easily solved by modifying the rtags-install function).

From emacs:

  1. M-x load-library RET rtags
  2. M-x rtags-install (this will fail, but it is required to create the *.sh file)

From shell
3. cd ~/<rtags-installation-path>/
4. chmod +x install-rtags.sh
5. rm rtags-<version>.tar.bz2
6. ./install-rtags.sh

If anyone else had a similar issue, I might create a fix, I just would like to know which tests should I run to ensure nothing got broken by my fix.

Environment (please complete the following information):

  • OS/Version: Debian 9 (stretch)
  • RTags(rdm,rc): 2.38.130
  • Emacs: 26.2
  • LLVM/Clang: 3.8.1-24
@zhihuiFan
Copy link

what is the location of your cmake? maybe your emacs uses a different search path for binary.

you may try add the following code to your init.el

(require 'exec-path-from-shell)

(after-load 'exec-path-from-shell
  (dolist (var '("SSH_AUTH_SOCK" "SSH_AGENT_PID" "GPG_AGENT_INFO" "LANG" "LC_CTYPE"))
    (add-to-list 'exec-path-from-shell-variables var)))


(when (memq window-system '(mac ns x))
  (exec-path-from-shell-initialize))

@sfavazza
Copy link
Author

sfavazza commented Jun 2, 2020

Yeah, I realized that my exec-path was not properly set because I start emacs in server-mode so it inherit only the PATH system variable before the user configuration is loaded.

Yet, I don't know whether all the observations I mentioned in the issue description are due to the failed Makefile execution.

@zhihuiFan
Copy link

I think we can fix the "cmake command not found" issue first by manually set exec-path at least , and then try if we still have another problems.

@sfavazza
Copy link
Author

sfavazza commented Jun 9, 2020

I ran the command again, from a fresh emacs instance and everything went smooth.

But I had to delete the curl-downloaded file first. Otherwise I was getting the confusing error message I mentioned in this thread.

Perhaps the Makefile could be modified with a mechanism to test whether the file to be downloaded is already there. If there ask the user to delete it before proceeding any further.

@sfavazza
Copy link
Author

Closing for inactivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants