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

gtags update fails #5911

Closed
3rd3 opened this issue Apr 27, 2016 · 12 comments
Closed

gtags update fails #5911

3rd3 opened this issue Apr 27, 2016 · 12 comments
Labels
Bug fix C/C++ Need repro steps stale marked as a stale issue/pr (usually by a bot) Tags

Comments

@3rd3
Copy link

3rd3 commented Apr 27, 2016

Description

When I save .cpp files I get a message Failed: update TAGS. I've searched the web, but couldn't find anything insightful.

Reproduction steps unknown.

System Info

  • OS: darwin
  • Emacs: 25.1.50.1
  • Spacemacs: 0.105.19
  • Spacemacs branch: master (rev. a298a5a)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
((ibuffer :variables ibuffer-group-buffers-by nil)
 (ranger :variables ranger-ignored-extensions
         '("mkv" "iso" "mp4" "avi" "mp4" "mkv" "zip" "rar" "exe" "ps" "webm" "png" "jpg" "jpeg" "tif" "tiff" "ics" "dmg" "swf" "gz" "m4a")
         ranger-max-preview-size 4 ranger-cleanup-eagerly t)
 (latex :variables latex-enable-auto-fill t)
 org git github version-control finance extra-langs markdown emacs-lisp haskell html javascript ipython-notebook shell-scripts java
 (haskell :variables haskell-enable-ghc-mod-support nil haskell-enable-ghci-ng-support t haskell-enable-hindent-style "gibiansky" haskell-enable-shm-support nil)
 (c-c   :variables c-c  -enable-clang-support t)
 gtags
 (python :variables python-test-runner 'pytest)
 (clojure :variables clojure-enable-fancify-symbols t)
 (shell :variables shell-default-height 20 shell-default-position 'bottom shell-enable-smart-eshell t shell-default-shell 'eshell)
 evil-commentary)
@ZhengshuaiPENG
Copy link

I can confirm this. The same when I save cpp file, it prompts failed

@shankmittal
Copy link

Same for Linux kernel project too on Ubuntu.

@deb0ch
Copy link
Contributor

deb0ch commented Jul 19, 2016

Same here, also when manually using helm-gtags-update-tags and ggtags-update-tags.

@delaanthonio
Copy link
Contributor

@3rd3 Just to be clear, did you create gtags in your project and then you get the error, or are you getting the error without using gtags?

@3rd3
Copy link
Author

3rd3 commented Jul 13, 2017

I am sorry, this is too long ago and I don't remember anymore. Perhaps other people do.

@krixkrix
Copy link

krixkrix commented Sep 3, 2017

Hmmm is this the bug I am seeing? I am testing the setup provided here:
https://tuhdo.github.io/c-ide.html.
The first time I run "helm-gtags-dwim" I am prompted to run gtags, I answer yes and select the parent directory. For GTAGSLABEL I choose default. The files GPATH, GRTAGS, GSYMS, GTAGS are created. And finding tags now works fine.
But then, when I try to update the database with "helm-gtags-update-tags" I get the message:
Failed: update tags(2)

Any help is appreciated.

@sdwolfz
Copy link
Collaborator

sdwolfz commented Sep 4, 2017

If you have emacs installed from source, you might have overwritten ctags with the one provided by emacs.

Execute: ctags --version
If you see something like this you need to reinstall ctags:

ctags (GNU Emacs 26.0.50)
Copyright (C) 2017 Free Software Foundation, Inc.
This program is distributed under the terms in ETAGS.README

The way I work around this is by configuring emacs with the following command:

./configure CFLAGS='-O2 -g3' --program-transform-name='s/^ctags$/ctags.emacs/'

That way emacs installs it's ctags (which should probably be named etags) with a different name.

Hope this helps.

@krixkrix
Copy link

krixkrix commented Sep 4, 2017

@SDWolf: Thanks for your input. This is probably not the right place for me to seek help, so I will limit myself to simply state that:
I have not installed emacs from source, just plain Ubuntu 16.04 repo packages. Emacs 24.5.1 and ctags claims to be: GNU Emacs 24.5.

@sdwolfz
Copy link
Collaborator

sdwolfz commented Sep 4, 2017

If ctags displays GNU Emacs 24.5. then maybe it was created by the emacs package when you installed it. Try removing and installing the ctags package and check the version again.

Also, if that fails, you can install ctags from source with the following steps:

git clone https://github.com/universal-ctags/ctags.git
cd ctags
./autogen.sh
./configure
make
sudo make install

This is sure to overwrite your current ctags binary in /usr/local/bin or /usr/bin.

@collinalexbell
Copy link

I installed ctags from source and am also getting this error

Failed: update tags(2)

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Feb 29, 2020
@evorion
Copy link

evorion commented Jul 20, 2021

I've just found another very contorted way to get: Failed: update TAGS(3)
I have .dir-locals.el for one of my C++ projects. Now, through a few hours of debugging, I've managed to figure out that on start of Emacs, Emacs checks for unsafe local variables and prompts you so that if you choose '!' these variables are written to ~/.emacs.d/.cache/.custom-settings

Upon this file being saved a save-hook is executed which ends up trying to update gtags for ~/.emacs.d/.cache/.custom-settings which is not going to work since GTAGS for that file has never been created. I've managed to confirm this bug by running gtags in the ~/.emacs.d/.cache folder which creates redundant gtags files but also makes the 'Failed: update TAGS(3)' message go away.

This is what Emacs was trying to run in the save-hook

global --single-update /home/vlatko/.emacs.d/.cache/.custom-settings

And the result was: Failed: update TAGS(3) <--- This error message is generated by emacs, you won't see it in the command line

So what I did was:

cd /home/vlatko/.emacs.d/.cache/
gtags

And now the 'Failed: update TAGS(3)' message is gone when I run

global --single-update /home/vlatko/.emacs.d/.cache/.custom-settings

manually and also when Emacs runs this from it's save-hook.

Edit (2023.09.19.): I've just used the same method to fix the same error when working with python. helm-gtags-update-tags is the culprit. All you need to do is figure out where you need to create the tags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug fix C/C++ Need repro steps stale marked as a stale issue/pr (usually by a bot) Tags
Projects
None yet
Development

No branches or pull requests

10 participants